I have seen several posts where people asked how to style a ColumnHeader for XamPivotGrid. It seems simple enough to change the style for all headers and I can do that already. However, I would like to be able to apply the style for just one header that corresponds to the current quarter. I was thinking I could do this with a DataTrigger in the style. I already tried applying a style when columns were added but couldn't figure out the right handler to make this happen.
To illustrate what I want is for the header of the column corresponding to the current quarter to be a different color. Nothing more, nothing less. For example, if Q4 2009 were the current quarter, then it would be colored red.
Hello Louis,
The XamPivotGrid’s LayoutUpdated event could be used to apply a style on a specific cell. This is the event that occurs when the layout update is completed, i.e. whatever the state of the grid is when the event is raised, that is what the users would see on the screen. I’m attaching a sample application where the described approach is used.
More detailed information for the number of events XamPivotGrid control exposes may be found in the following help topics:
http://help.infragistics.com/NetAdvantage/Silverlight/2012.2/CLR4.0/?page=xamPivotGrid_Getting_Started_with_xamPivotGrid.html
http://help.infragistics.com/NetAdvantage/Silverlight/2012.2/CLR4.0/?page=xamPivotGrid_HandlingEvents.html
Please, let me know if you need further assistance on the matter.
Thank you Galina, that helped a lot. I was attempting to set the DataTemplate this way:
var columnHeaderTemplate = new HeaderTemplate();columnHeaderTemplate.Template = Resources["ColumnHeaderDataTemplate3"] as DataTemplate;columnHeaderTemplate.Hierarchy = "Q12013"; // hardcoded: Need to figure out which header to apply tocolumnHeaderTemplate.Level = 1; // Need to figure out the correct levelxamPivotGrid.ColumnHeaderTemplates.Add(columnHeaderTemplate);xamPivotGrid.RowHeaderTemplates.Add(columnHeaderTemplate);
This just wasn't working. I don't know why this method didn't work but your sample does what I need so I'll accept that answer.
Hi Louis,
I'm glad to hear my approach was helpful to you.
Please let me know if you need further assistance.