We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to better show filtered columns to the user ?

Hi,

Is it possible in SfDataGrid to dinamically change the header background color of a column as soon as this column becomes filtered so that it is more evident to the user ?

Silvio

Attachment: syncfusion_(2)_ccf25a23.zip

1 Reply

JS Jayapradha S Syncfusion Team March 21, 2016 12:00 PM UTC


Hi Silvio,

Thank you for contacting Syncfusion Support.

We have analyzed your requirement. You can change the column header background when applying filter to that column by using SfDataGrid.FilterChanged event as shown below,

Code Example:
this.datagrid.FilterChanged += datagrid_FilterChanged;  

void datagrid_FilterChanged(object sender, GridFilterEventArgs e)

        {

            if (e.FilterPredicates != null && e.FilterPredicates.Count > 0)

                e.Column.HeaderStyle = App.Current.FindResource("headerStyle") as Style;

            else

                e.Column.HeaderStyle = new Style();        
        }

<Style x:Key="headerStyle" TargetType="Syncfusion:GridHeaderCellControl">

            <Setter Property="Background" Value="Green" />

</Style>


We have prepared a sample for your requirement and please find the sample from the following location,
Sample Link: http://www.syncfusion.com/downloads/support/forum/123455/ze/Filter_Changed_123455-674810504  

Regards,
Jayapradha


Loader.
Up arrow icon