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,
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.
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 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 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.
thank you for your advice. Since my last reply I already tried what you suggested, but there are several problems I don't know how to solve.
The situation in our application: Because we have several report tables in our application, which shall have the same layout, we decided to integrate the original XAML-Code for the XamGrid. So we took the file "generic.xaml" from the directory "\Infragistics\NetAdvantage 2013.1\WPF\DefaultStyles\XamGrid" and added it to our application as a Ressource dictionary. In the attached zip-file you can take a look to the file "IGXamGrid.xaml". In the file "LookAndFeel.xaml" we also had to merge this dictionary.
Following your former suggestions I made some modifications in the XAML code and used some SolidColor-Brushes instead of the original LinearGradient-Brushes. So I got the desired hover behavior in the header cells. I also made some changes to get an other background color for the header cells. This works good.
Problems:
1. For those columns where I need to add an individual HeaderStyle I get the default hover behavior again. I described that in my former reply.
2. I don't know how I can prefer of the "BasedOn"-functionality because all relevant styles I would like to use don't have a Key (e.g. styles with TargetTypes: igPrim:HeaderCellControl or igPrim:ChildBandCellControl). As soon as I add a Key (e.g. "<Style x:Key="IGHeaderCellControlStyle" TargetType="igPrim:HeaderCellControl">") to one of these styles I get the default layout for header cells again. I will provide two screenshots for you.
Could you please tell me how we could realize what we need to do?
Regards, chrisobs
Hello chrisobs,
Thank you for the feedback. I am glad you have found a solution to your issue.
yesterday afternoon I continued my work on this problem and now everything works fine. The last problem occured because the column, I needed to assign my special style to, was a GroupColumn. So I had to define my style based on the style for GroupHeaderCellControls and not for HeaderCellControls. This was the solution.
Thank you for your support!
Regards,
chrisobs
Hello chrissobs,
I am just checking your progress on the issue. Please do not hesitate to let me know if you have any further questions on this matter.
I have been looking into your issue and I have created a small sample application for you. In the application I have used the resource dictionary you have provided.
When you set a Key for a style this style would not apply until you assign the key to a part of the XamGrid.
In the application I have set Key for the HaderCellControl, in order to have a base for the other styles. Then in order to apply this as default style I have created additional style for the HeaderCellControl in the ResourceDictionary, based on the first one and without key.
Additionally I have created a new style for the header cell control in the resources of the XamGrid itself. The new style is based on the one with key from the resource dictionary and can change properties primary set in the first style. This is how you can apply style that has some of the properties changed and there is no hover for the header cell.
In fact I can suggest to set the color for the Hover brushes to ‘Transparent’. This why whatever color is set as Background for the header, there should be no hover color.