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

how to sort a converted column.

4 Answers 182 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Pankaj
Top achievements
Rank 1
Pankaj asked on 03 Jun 2011, 09:36 AM

Hi,

I have my grid defined as follows:

 

 

 

 

 

 

<telerik:RadGridView
            x:Name="RadGridView"
            AutoGenerateColumns="False"
            IsReadOnly="True"
            ItemsSource="{Binding VerificationPathsData}"
            SelectedItem="{Binding SelectedItem}" Loaded="RadGridView_Loaded" >
            <telerik:RadGridView.Columns>
  
                <telerik:GridViewDataColumn
                    Header="Verification Path Pair" 
                    UniqueName="VerificationPathPair"
                    DataMemberBinding="{Binding Path=., Converter={StaticResource VPPair}}"
                    />
                 <--Other COlumns follow--> 
                
I want the grid to be sorted based on this 'Verification Path Pair' column. I tried using columnsortdescrptor but that gave me error.
private void RadGridView_Loaded(object sender, System.Windows.RoutedEventArgs e)
       {
           Telerik.Windows.Controls.RadGridView rgv = (Telerik.Windows.Controls.RadGridView)sender;
           ColumnSortDescriptor csd = new ColumnSortDescriptor()
           {
               Column = rgv.Columns["VerificationPathPair"],
               SortDirection = ListSortDirection.Descending
           };
           rgv.SortDescriptors.Add(csd);
       }
Please suggest how can I have grid sorted based on this column.

4 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 07 Jun 2011, 04:10 PM
Hello Pankaj,

 
You may use expression sort descriptor .


All the best,
Pavel Pavlov
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
0
Pankaj
Top achievements
Rank 1
answered on 08 Jun 2011, 06:10 AM
Hi Pavel,

Could you please provide some code specific to my grid. I read on the blog but was not able to implent for my grid.

Thanks,
Pankaj
0
Jason
Top achievements
Rank 1
answered on 30 Sep 2011, 09:48 PM
Pavel,

I would also like to see how to do this but the linked article seeminly has an error being retrieved from the server whether I try to access it from the link provided or through the archive.

Thanks,
Jason
0
Atanas
Telerik team
answered on 04 Oct 2011, 11:27 AM
Hello Jason,

There was a broken blog post link which is fixed now. You can open it from here.

Please take our apologies for the inconvenience caused!

All the best,
Atanas
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Pankaj
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Pankaj
Top achievements
Rank 1
Jason
Top achievements
Rank 1
Atanas
Telerik team
Share this question
or