This question is locked. New answers and comments are not allowed.
Let's say I have a dataset and grid defined like this:
I would like to be able to set a "SortField" on the GroupDescriptor so that the groups (Project Priorities in this example) would actually be sorted using their SortOrder property (Critical=1; High=2; Medium=3; Low=4) and not their string value but the string value would still be shown as the "Group Name"... Is something like this possible?
ObservableCollection<Priority> ListOfPriorities = new ObservableCollection<Priority>() { new Priority() { Name = "Low", ID = 6, SortOrder = 4 }, new Priority() { Name = "Medium", ID = 1, SortOrder = 3 }, new Priority() { Name = "High", ID = 5, SortOrder = 2 }, new Priority() { Name = "Critical", ID = 3, SortOrder = 1 } }; ObservableCollection<Project> TheList = new ObservableCollection<Project>(); for (int i = 1; i <= 10; i++) { Projectp = new Project() { ID = 1000 + i, Name = Guid.NewGuid().ToString(), ProjectPriority = ListOfPriorities[i % 4], }; TheList.Add(p); } this.dg.DataContext = TheList; GroupDescriptor gd = new GroupDescriptor() { Member = "ProjectPriority.Name", SortDirection = System.ComponentModel.ListSortDirection.Descending, DisplayContent = "ProjectPriority.Name", MemberType = typeof(string), AggregateFunctions = new AggregateFunctionCollection() { new CountFunction() { Caption = "count=", ResultFormatString = "[{0}]} } }; this.dg.GroupDescriptors.Add(gd);I would like to be able to set a "SortField" on the GroupDescriptor so that the groups (Project Priorities in this example) would actually be sorted using their SortOrder property (Critical=1; High=2; Medium=3; Low=4) and not their string value but the string value would still be shown as the "Group Name"... Is something like this possible?