Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
500
XamGrid - How to deactivate the default hover behvior in column header cells
posted

Hello,
we need to deactivate the default hover behavior of the column header cells.

Up to now I tried the following:

1. I create a TextColumn in code behind:

TextColumn col = new TextColumn();
col.Key = "[rg" + iRG.ToString() + "fct" + iF.ToString() + "]";
col.HeaderText = _selFacts[iF - 1].Name;
col.Width = new ColumnWidth(100, false);
col.HeaderStyle = (Style)FindResource("MyHoverStyle");

The Key is created dynamically and the HeaderText is the name of a Fact (e.g. "Turnover [abs.]"). I set the HeaderStyle.

2. I define the Style for the header in XAML:

<Style x:Key="MyHoverStyle" TargetType="{x:Type igDP:DataRecordCellArea}">
 <Setter Property="BackgroundHover" Value="LightGray"/>
</Style>
           
3. I also tried to change the Brush definitions within the XamGrid.Resources:
<ig:XamGrid x:Name="gridTable1" Grid.Column="0" Margin="0,5,5,5" HeaderRowHeight="Dynamic" AutoGenerateColumns="false" ColumnLayoutHeaderVisibility="Never" KeyboardNavigation="AllLayouts" InitializeRow="gridTable_InitializeRow" Loaded="gridTable1_Loaded" RowExpansionChanged="gridTable1_RowExpansionChanged" ColumnSorting="gridTable1_ColumnSorting" ColumnResized="gridTable1_ColumnResized" ColumnResizing="gridTable1_ColumnResizing">
    <ig:XamGrid.Resources>
        <LinearGradientBrush x:Key="HeaderHoverBackgroundBrush" StartPoint="0,0" EndPoint="0,1">
            <LinearGradientBrush.GradientStops>
                <GradientStopCollection>
                    <GradientStop Offset="0" Color="LightGray"/>
                    <GradientStop Offset="0.35" Color="LightGray"/>
                    <GradientStop Offset="1" Color="LightGray"/>
                </GradientStopCollection>
            </LinearGradientBrush.GradientStops>
        </LinearGradientBrush>
        <SolidColorBrush x:Key="HeaderHoverForegroundBrush" Color="LightGray"/>
    </ig:XamGrid.Resources>
</ig:XamGrid>

The use of "LightGray" was only for a test. Probably I should use "Transparent"?

Up to now nothing worked. The standard hover styles are still active. Could you please tell me what I must do?

Regards

 

Parents
No Data
Reply
  • 22015
    posted

      Hello,

     Thank you for your post. I have been looking into it and have created a small sample application for you.

    In the sample I am using the default style for the HeaderCellControl. This style applies for all of the headers of the xamGrid. From this style you can see, that several VisualStates are defined, including one for ‘MouseOver’. In this visual state a linear brush is applied.

    I have changed that brush to a SolidColorBrush, which color is Transparent.

    Please find the attached sample application and feel free to let me know if you have any further questions on this matter.

    Grid_DefaultHover.zip
Children