This question is locked. New answers and comments are not allowed.
I'm having a problem with the sort descriptors being cleared from the grid when my data source is updated. Here is a sample I created to recreate the problem.
Thanks,
Chris
<UserControl x:Class="RedHeaderTest.MainPage" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"> <Grid x:Name="LayoutRoot"> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <StackPanel Orientation="Horizontal"> <Button Content="Hookup Data" Width="Auto" Margin="4,2,4,2" Click="Button_Click"/> </StackPanel> <telerik:RadGridView Margin="5" Grid.Row="1" AutoGenerateColumns="False" x:Name="ParentGrid" ShowGroupPanel="False"> <telerik:RadGridView.Columns> <telerik:GridViewDataColumn Width="100" UniqueName="Col1" DataMemberBinding="{Binding Path=Col1}"> <telerik:GridViewDataColumn.Header> <TextBlock Text="Col1" TextAlignment="Left" HorizontalAlignment="Stretch" VerticalAlignment="Center"/> </telerik:GridViewDataColumn.Header> </telerik:GridViewDataColumn> <telerik:GridViewDataColumn Width="100" UniqueName="Col2" DataMemberBinding="{Binding Path=Col2}"> <telerik:GridViewDataColumn.Header> <TextBlock Text="Col2" TextAlignment="Left" HorizontalAlignment="Stretch" VerticalAlignment="Center"/> </telerik:GridViewDataColumn.Header> </telerik:GridViewDataColumn> <telerik:GridViewDataColumn Width="100" UniqueName="Col3" DataMemberBinding="{Binding Path=Col3}"> <telerik:GridViewDataColumn.Header> <TextBlock Text="Col3" TextAlignment="Left" HorizontalAlignment="Stretch" VerticalAlignment="Center"/> </telerik:GridViewDataColumn.Header> </telerik:GridViewDataColumn> <telerik:GridViewDataColumn Width="100" UniqueName="Col4" DataMemberBinding="{Binding Path=Col4}"> <telerik:GridViewDataColumn.Header> <TextBlock Text="Col4" TextAlignment="Left" HorizontalAlignment="Stretch" VerticalAlignment="Center"/> </telerik:GridViewDataColumn.Header> </telerik:GridViewDataColumn> </telerik:RadGridView.Columns> </telerik:RadGridView> </Grid></UserControl>using System;using System.Collections.Generic;using System.Linq;using System.Net;using System.Windows;using System.Windows.Controls;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Animation;using System.Windows.Shapes;namespace RedHeaderTest{ public partial class MainPage : UserControl { private List<ParentData> _data; public MainPage() { this._data = new List<ParentData>(); this._data.Add(new ParentData() { Col1 = "Row1 Col1", Col2 = "Row1 Col2", Col3 = "Row1 Col3", Col4 = "Row1 Col4", ChildData = new List<ChildData>( new ChildData[] { new ChildData() { Col1 = "ParentRow1 Row1 Col1", Col2 = "ParentRow1 Row1 Col2", Col3 = "ParentRow1 Row1 Col3", Col4 = "ParentRow1 Row1 Col4", }, new ChildData() { Col1 = "ParentRow1 Row2 Col1", Col2 = "ParentRow1 Row2 Col2", Col3 = "ParentRow1 Row2 Col3", Col4 = "ParentRow1 Row2 Col4", }, new ChildData() { Col1 = "ParentRow1 Row3 Col1", Col2 = "ParentRow1 Row3 Col2", Col3 = "ParentRow1 Row3 Col3", Col4 = "ParentRow1 Row3 Col4", }, new ChildData() { Col1 = "ParentRow1 Row4 Col1", Col2 = "ParentRow1 Row4 Col2", Col3 = "ParentRow1 Row4 Col3", Col4 = "ParentRow1 Row4 Col4", } }) }); this._data.Add(new ParentData() { Col1 = "Row2 Col1", Col2 = "Row2 Col2", Col3 = "Row2 Col3", Col4 = "Row2 Col4", ChildData = new List<ChildData>( new ChildData[] { new ChildData() { Col1 = "ParentRow2 Row1 Col1", Col2 = "ParentRow2 Row1 Col2", Col3 = "ParentRow2 Row1 Col3", Col4 = "ParentRow2 Row1 Col4", }, new ChildData() { Col1 = "ParentRow2 Row2 Col1", Col2 = "ParentRow2 Row2 Col2", Col3 = "ParentRow2 Row2 Col3", Col4 = "ParentRow2 Row2 Col4", }, new ChildData() { Col1 = "ParentRow2 Row3 Col1", Col2 = "ParentRow2 Row3 Col2", Col3 = "ParentRow2 Row3 Col3", Col4 = "ParentRow2 Row3 Col4", }, new ChildData() { Col1 = "ParentRow2 Row4 Col1", Col2 = "ParentRow2 Row4 Col2", Col3 = "ParentRow2 Row4 Col3", Col4 = "ParentRow2 Row4 Col4", } }) }); this._data.Add(new ParentData() { Col1 = "Row3 Col1", Col2 = "Row3 Col2", Col3 = "Row3 Col3", Col4 = "Row3 Col4", ChildData = new List<ChildData>( new ChildData[] { new ChildData() { Col1 = "ParentRow3 Row1 Col1", Col2 = "ParentRow3 Row1 Col2", Col3 = "ParentRow3 Row1 Col3", Col4 = "ParentRow3 Row1 Col4", }, new ChildData() { Col1 = "ParentRow3 Row2 Col1", Col2 = "ParentRow3 Row2 Col2", Col3 = "ParentRow3 Row2 Col3", Col4 = "ParentRow3 Row2 Col4", }, new ChildData() { Col1 = "ParentRow3 Row3 Col1", Col2 = "ParentRow3 Row3 Col2", Col3 = "ParentRow3 Row3 Col3", Col4 = "ParentRow3 Row3 Col4", }, new ChildData() { Col1 = "ParentRow3 Row4 Col1", Col2 = "ParentRow3 Row4 Col2", Col3 = "ParentRow3 Row4 Col3", Col4 = "ParentRow3 Row4 Col4", } }) }); InitializeComponent(); this.ParentGrid.Columns[1].SortingState = Telerik.Windows.Controls.SortingState.Descending; } private void Button_Click(object sender, RoutedEventArgs e) { this.ParentGrid.ItemsSource = this._data; } } public class ParentData { public string Col1 { get; set; } public string Col2 { get; set; } public string Col3 { get; set; } public string Col4 { get; set; } private List<ChildData> _childData; public List<ChildData> ChildData { get { return this._childData; } set { this._childData = value; } } } public class ChildData { public string Col1 { get; set; } public string Col2 { get; set; } public string Col3 { get; set; } public string Col4 { get; set; } }}Thanks,
Chris