Initial sorting in a grid

2 posts, 0 answers
  1. rubenhak
    rubenhak avatar
    58 posts
    Member since:
    Dec 2008

    Posted 16 Aug 2010 Link to this post


    Is it possible to make the grid to be sorted initially? 
    I'd prefer a declarative way to do it (in XAML).

    Can you guys provide an example of a grid which is initially sorted by some column.

    Thank you very much,
  2. Milan
    Milan avatar
    1989 posts

    Posted 17 Aug 2010 Link to this post

    Hello rubenhak,

    There is no problem to do that in XAML - just create a SortDescriptor like this:

    <telerik:RadGridView Name="playersGrid" 
                         ItemsSource="{Binding Players}" 
            <!-- define initial sorting by name-->
            <telerik:SortDescriptor Member="Name"/>
            <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}"/>
            <telerik:GridViewDataColumn DataMemberBinding="{Binding Number}"/>
            <telerik:GridViewDataColumn DataMemberBinding="{Binding Position}"/>
            <telerik:GridViewDataColumn DataMemberBinding="{Binding Country}"/>

    Best wishes,
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top