To reproduce:
public RadForm1()
{
InitializeComponent();
this.radPropertyGrid1.SelectedObject = new Item("zero", "uniqueId","alpha");
this.radPropertyGrid1.EnableSorting = true;
SortDescriptor sort = new SortDescriptor("Value", ListSortDirection.Ascending);
this.radPropertyGrid1.SortDescriptors.Add(sort);
}
public class Item
{
public string Text { get; set; }
public string Identifier { get; set; }
public string Value { get; set; }
public Item(string text, string identifier, string value)
{
this.Text = text;
this.Identifier = identifier;
this.Value = value;
}
}
Workaround#1: Set SortOrder to None
this.radPropertyGrid1.SortOrder = SortOrder.None;
Workaround#2: use a custom comparer:
this.radPropertyGrid1.SortDescriptors.Add(sort);
this.radPropertyGrid1.PropertyGridElement.PropertyTableElement.ListSource.CollectionView.Comparer = new MyComparer();
public class MyComparer : IComparer<Telerik.WinControls.UI.PropertyGridItem>
{
int IComparer<Telerik.WinControls.UI.PropertyGridItem>.Compare(Telerik.WinControls.UI.PropertyGridItem x, Telerik.WinControls.UI.PropertyGridItem y)
{
if (x.Value != null && y.Value != null)
{
return x.Value.ToString().CompareTo(y.Value.ToString());
}
return 0;
}
}