Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
115
Highlighting a filtered column
posted

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

 

 

(var recordFilter in

tradeGrid.FieldLayouts[0].RecordFilters

.Where(rf => rf.Conditions.Count > 0))

{

 

 

var

labelPresenterStyle =

tradeGrid.FieldLayouts[0].Fields[recordFilter.FieldName].Settings.LabelPresenterStyle

??

 

new Style

();

 

 

var backgroundSetter = new Setter(BackgroundProperty, new SolidColorBrush(Colors

.LightPink));

 

 

if

(!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?