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 chrisobs,
Thank you for the feedback. I am glad you have found a solution to your issue.
Hello Gergana,
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.
Please find the attached sample application and feel free to let me know if you have any further questions 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