RadGridView; Sort arrows ?

5 posts, 1 answers
  1. Barry
    Barry avatar
    31 posts
    Member since:
    May 2016

    Posted 31 May 2016 Link to this post

    Hi,

    I'm using the IsolatedStorage mechanism to get/set my sorts for all my RadGridView(s)...but I need arrows to indicate ASC or DESC for the user selection from the column headers.

    Any tips ?

    Barry

     

    P.S. I'll also need the same for RadTreeView (which uses manual sorting)

  2. Barry
    Barry avatar
    31 posts
    Member since:
    May 2016

    Posted 01 Jun 2016 Link to this post

    I need to clarify this question. I just discovered that the original code author is using a custom style that is over-riding the default style, and thus the arrows. So my bad for not seeing that earlier. So now the question is, how to get CUSTOM arrow for the column headers in RadGridView ? The background is dark blue, so the default black will never work, so I need to use white ones.
  3. Answer
    Martin Vatev
    Admin
    Martin Vatev avatar
    129 posts

    Posted 03 Jun 2016 Link to this post

    Hello Barry,

    To achieve the desired behavior, you can attach to the RadGridView's Loaded event and in it with the extension method ChildrenOfType of the grid to find all Paths with name equal to PART_SortIndicator. Then you only need to change the Fill property with the brushes which you want. For your convenience I prepared a code snippet:
     
    void RadGridView_Loaded(object sender, RoutedEventArgs e)
        {          
            var sortIndicators = this.clubsGrid.ChildrenOfType<Path>().Where(x => x.Name == "PART_SortIndicator");
            foreach (Path sortIndicator in sortIndicators)
            {
                sortIndicator.Fill = Brushes.White;
            }
        }

    Another approach would be to find this Path element in the default template and change its Fill property there.
    I hope that this helps.

    Regards,
    Martin Vatev
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  4. Barry
    Barry avatar
    31 posts
    Member since:
    May 2016

    Posted 07 Jun 2016 in reply to Martin Vatev Link to this post

    Can you "remind me" what the <Path> type is in your snippet ?:

     

    oid RadGridView_Loaded(object sender, RoutedEventArgs e)
        {          
            var sortIndicators = this.clubsGrid.ChildrenOfType<Path>().Where(x => x.Name =="PART_SortIndicator");
            foreach (Path sortIndicator in sortIndicators)
            {
                sortIndicator.Fill = Brushes.White;
            }

  5. Martin Vatev
    Admin
    Martin Vatev avatar
    129 posts

    Posted 09 Jun 2016 Link to this post

    Hello Barry,

    The full "Path" type in my code snippet is System.Windows.Shapes.Path.
    Here you may take a look for detailed information on the matter.

    I hope this helps.

    Regards,
    Martin Vatev
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top