views:

33

answers:

1

I will use a template to show the header of a datagrid but when i filter on a column i want to show a filtericon. Is there a easy way to do that?

A: 

Take a look at the built-in template for DataGridColumnHeader found in here: DataGrid Styles and Templates

Note how the Visual State Manager is being used to show the sorted states of the column. You could add another State Group for FilteredStates with the members "Unfiltered" and "Filtered". You would then add the approriate Icon to the content and a Storyboard to the "Filtered" state to display the Icon.

However since the filtered states are unknown to DataGrid it will be up to you to call VisualStateManager.GoToState appropriately for the columns as required.

AnthonyWJones