XamPivotGrid orders the dimensions based on their Name. How can I order them based on their Captions?
What you can see in the metadata tree is based on the content of DataSourceBase.Metadata property. You can modify it and re-create metadata tree hierarchy structured in the way you like.
Regards.Plamen.
Hi Plamen,
can you post an sample or provide some details on how to re-create metadata tree hierarchy structured in the way we need?
Thanks!
Fabian
Hello Fabian,
Here it is how the root node items can be ordered in descending:
this.pivotGrid.DataSource.Initialized += (s, a) => { DataSourceBase dataSourceBase = (DataSourceBase) this.pivotGrid.DataSource; IList<HierarchicalItem> items = dataSourceBase.Metadata[0].Items.ToList(); dataSourceBase.Metadata[0].Items.Clear();
foreach (HierarchicalItem hierarchicalItem in items.OrderByDescending(hi => hi.Caption)) { dataSourceBase.Metadata[0].Items.Add(hierarchicalItem); } };
You can perform such Clear/Add for any node in the hierarchy.