Hi all, I'm trying to set the background colour of a column header if it has a filter applied to it but am having some difficulty...
I'm written the following C# (I can't find a property to flag "IsFitered" in order to perform it in Xaml) to iterate through each column. You'll have to excuse the lack of code formatting (how CAN I do this!?):
foreach
tradeGrid.FieldLayouts[0].RecordFilters
.Where(rf => rf.Conditions.Count > 0))
{
labelPresenterStyle =
tradeGrid.FieldLayouts[0].Fields[recordFilter.FieldName].Settings.LabelPresenterStyle
??
();
.LightPink));
(!labelPresenterStyle.Setters.Contains(backgroundSetter))
labelPresenterStyle.Setters.Add(backgroundSetter);
tradeGrid.FieldLayouts[0].Fields[recordFilter.FieldName].Settings.LabelPresenterStyle =
labelPresenterStyle;
}
I can confirm that the LabelPresenterStyle is being persisted and the second time I filter, the style has been persisted. Any ideas why I'm not seeing a LightPink background for my filtered columnn labels?
Hi Petar,
Thanks for your reply. I've actually found that solution previously (which now forms PART of the solution to my woes!) Thanks for pointing me in its direction.
How would you recommend loading up the filters during a XamDataGrid.LoadCustomizations though? (Sure, the filters will load and be applied as necessary, but is there any way to ensure that their highlighting is loaded up with the grid?)
I'm currently applying individual column colours in the RecordFilterChanged event and performing a foreach over all of the record filters on RecordsInViewChanged (which as you can imagine, gets called a fair few times during the loading of a large dataset) to ensure that persisted filters are given colour.
Are there any less "hacky" ways around this?
Many thanks,Rob
Hello,
I have been looking into your issue and despite there is no built-in way to do this here is an answered forum thread for that same request which describes a custom approach and even has an attached sample project: http://community.infragistics.com/forums/p/43521/239179.aspx
Hope this helps.
Sincerely,
Petar Monov
Developer Support Engineer
Infragistics Bulgaria
www.infragistics.com/support