Is it possible to remove measures from "columns/rows" section in data selector?
I would like to set them visible in section "1" (under "measures" tree node) but I would like to remove them from section "2":
Hello,
I have been investigating this and have found a way for you to achieve your goal by iterating through the DataSource’s HierarchicalItems. Here is a code snippet you can use in the property changed event of the DataSource of your XamPivotDataSelector:
dataSelector.DataSource.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(DataSource_PropertyChanged);
…
void DataSource_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
if (e.PropertyName == "Metadata")
HierarchicalItem rootItem = (sender as DataSourceBase).Metadata[0];
List<HierarchicalItem> theChosenOnes = new List<HierarchicalItem>();
foreach (HierarchicalItem item in rootItem.Items)
if ((item.Caption=="Units sold")||(item.Caption=="Amount of sale"))
theChosenOnes.Add(item);
}
if (theChosenOnes.Count>0)
foreach (var item in theChosenOnes)
rootItem.Items.Remove(item);
Please let me know if you require any further assistance on the matter.
Sincerely,
Petar Monov
Developer Support Engineer
Infragistics Bulgaria
www.infragistics.com/support
Is it possible to do this "automatically"? How can I get all measures from DataSource?