This is a migrated thread and some comments may be shown as answers.

RadGridView; Sort arrows ?

4 Answers 186 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Barry
Top achievements
Rank 1
Barry asked on 31 May 2016, 08:49 PM

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)

4 Answers, 1 is accepted

Sort by
0
Barry
Top achievements
Rank 1
answered on 01 Jun 2016, 06:31 PM
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.
0
Accepted
Martin
Telerik team
answered on 03 Jun 2016, 03:12 PM
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.
0
Barry
Top achievements
Rank 1
answered on 07 Jun 2016, 04:18 PM

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;
        }

0
Martin
Telerik team
answered on 09 Jun 2016, 12:20 PM
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.
Tags
GridView
Asked by
Barry
Top achievements
Rank 1
Answers by
Barry
Top achievements
Rank 1
Martin
Telerik team
Share this question
or