How to change column header colour if filter is applied?

4 posts, 1 answers
  1. Kamila
    Kamila avatar
    3 posts
    Member since:
    Mar 2012

    Posted 08 Nov 2012 Link to this post

    Hi

    I have a lot of columns and my users have a problem to find filtered columns.

    They have a problem becouse then don't see that icon "filter" changed color.


    Kamila
  2. Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 08 Nov 2012 Link to this post

    Hello,

    To achieve this you will need 2 different things, first you will have to handle the ViewCellFormatting event described in this thread, with a slight modification, instead of using the MouseMove event, you should check if the column corresponding to the current cell is being sorted on or not. You can find out how to get the current sort descriptors as explained in this thread

    Hope this helps, if you have any other questions, please let me know.

    Best Regards,
    Emanuel Varga
    WinForms MVP
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Kamila
    Kamila avatar
    3 posts
    Member since:
    Mar 2012

    Posted 08 Nov 2012 Link to this post

    Thank you for very very very very quick response :-)

    You write about "cell is being sorted on or not".

    I hope so that in similar way i will check if cell is filtered or not. Because I need change color of column header when filter is applied - not when id sorted.
    But ... it It also may be useful to me :-)
    I can color header when user sort, filter or both

    Kamila
  5. Answer
    Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 08 Nov 2012 Link to this post

    Hello,

    Yes, it is almost the same, it is just named FilterDescriptor (http://www.telerik.com/help/winforms/gridview-filtering-setting-filters-programmatically-simple-descriptors.html).

    Sorry for the confusion...

    Best Regards,
    Emanuel Varga
    WinForms MVP
Back to Top