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
Hello Chris,
I have been looking into your question.
You can set a Key for the first style and apply it for the HeaderCellControl. Then when you are creating the second style for the HeaderCellControl you can set it to be based on the first one. This way you would have the hover disabled and the new settings for the Background and BorderThickness too. You can do this by setting the BasedOn property.
Here is a link, where you can find more information about this property: http://msdn.microsoft.com/en-us/library/system.windows.style.basedon(v=vs.110).aspx.
Please do not hesitate to let me know if you have any further question on this matter.
Hello Gergana or hello to anybody else of the Infragistics support team,
would it be possible to get an answer to my question. It would be very helpfull for us, because this fundamental problem has an influence on how we would create the layout of several, very different, report tables.
Hello Gergana,
thank your very much for the sample.
Deactivating the standard hover behavior works fine, but now I have a special problem. I need to have the opportunity to control the layout of header cells individually. Up to now I accomplished that by the use of special styles, I assigned to the HeaderStyle property of a GroupColumn or TextColumn.
I attached to images for you to explain what I need to do. In a certain case I must add another GroupColumn to the grid:
emptyColGroup = new GroupColumn();emptyColGroup.Key = "emptyGroup";emptyColGroup.HeaderText = "Concepts";emptyColGroup.HeaderStyle = (Style)FindResource("NormalColHeaderStyleWithRightBorder");
Then I assign a special style because for that cell I only want to keep the right border.
<Style x:Key="NormalColHeaderStyleWithRightBorder" TargetType="igPrim:HeaderCellControl"> <Setter Property="Background" Value="#f6f7f8" /> <Setter Property="BorderThickness" Value="0,0,1,0"/></Style>
When I assign this style I get the layout I want. You can see that when you take a look at the image file "HeaderCellWithSpecialHeaderStyle.PNG". But as a result of this assignment, this cell has the default hover behavior again, which I also need to deactivate.
Without this special header style the cell would have all borders as you can see in the image file "HeaderCellWithoutSpecialHeaderStyle.PNG". Here the default hover behavior is deactivated.
How could I achieve to deactivate the default hover behavior and still have the opportunity to control the header cell layout individually?
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.