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

[Solved] Windows 8 RadDataGrid perform sorting on DataGridTemplateColumn?

1 Answer 57 Views
Grid for XAML
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Balraj
Top achievements
Rank 1
Balraj asked on 02 Nov 2013, 08:36 PM
I have created DataGridTemplateColumn in RadDataGrid. How can i implement sorting on click of header name with display of up and down arrows besides column name as it comes in DataGridNumericalColumn. The XAML code is mentioned below for that column:

 <telerikGrid:DataGridTemplateColumn
                                                    CellContentTemplateSelector="{StaticResource UpDownTemplateSelector}"
                                                    HeaderStyle="{StaticResource HeaderStyleProduct}">
                    <telerikGrid:DataGridTemplateColumn.Header>
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                            <TextBlock Text="{Binding ElementName=thisPage, Path=Name}" Style="{StaticResource ReportTypeStyleTextProduct}"/>
                        </StackPanel>
                    </telerikGrid:DataGridTemplateColumn.Header>
                </telerikGrid:DataGridTemplateColumn>

CellContentTemplate has one label and an image besides it. This column displays number value which is comma separated like 956,000

Please let me know the answer ASAP. In urgent need. Thanks in advance.

1 Answer, 1 is accepted

Sort by
0
Rosy Topchiyska
Telerik team
answered on 04 Nov 2013, 12:54 PM

Hello Balraj,

Thank you for using RadControls for Windows 8!

The DataGridTemplateColumn has a SortDescriptor property that defines how the column will be sorted when the user taps on the header. Here are two articles from our online documentation where you can read more about the two types sort descriptors supported by the RadDataGrid control:

Analogically to the examples from these articles, instead of adding a descriptor to the SortDescriptors collection of the grid, you have to set the SortDescriptor property of the template column. I have attached a sample application that demonstrates how you can do that.

I hope this information was useful. Please, do not hesitate to contact us if you need further assistance.

Regards,
Rositsa Topchiyska
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
Grid for XAML
Asked by
Balraj
Top achievements
Rank 1
Answers by
Rosy Topchiyska
Telerik team
Share this question
or