How to sort the items under some node in Silverlight tree view?
-
How to sort the items under some node in Silverlight tree view? Thank you in advance. Regards, Goran
-
How to sort the items under some node in Silverlight tree view? Thank you in advance. Regards, Goran
Are you using proper data binding for your tree? Or are you hand inserting items? If you hand inserted, no choice but to rearrange by hand. If you are using data binding, just sort that part of the collection and the UI will auto-magically update.
-
Are you using proper data binding for your tree? Or are you hand inserting items? If you hand inserted, no choice but to rearrange by hand. If you are using data binding, just sort that part of the collection and the UI will auto-magically update.
I'm manually inserting data, but in WPF this works for me:
// Sort actions and statuses by time if (treeAdditionalInfo.Items.Count != 0) { foreach (TreeViewItem subsystemNodeItem in treeAdditionalInfo.Items) { foreach (TreeViewItem formNodeItem in subsystemNodeItem.Items) { formNodeItem.Items.SortDescriptions.Add(new System.ComponentModel.SortDescription("Tag", System.ComponentModel.ListSortDirection.Ascending)); } } }
It means, I want to sort the node items by Tag property of items. I can't see I could do the same in Silverlight. I've tried to find something on internet, but no luck so far. I appreciate any help. Thanks.