I have a XamPivotGrid and Expander which use a defined XmlaDataSource when the application loads. I would like to change the Rows, Columns, Measures, etc .. in code when the users selects a item from a dropdown. Do you have a simple example of this?
Hi
In case where you don’t want to use XamDataSelector for pupolate xamPivotGrid with data, you should work with data source metadata tree.
Bellow is example how you can add dimension for the rows in xamPivotGrid
XmlaDataSource ds = pivotGrid.DataSource as XmlaDataSource;
HierarchicalItem root = ds.Metadata[0];
HierarchicalItem dimension = root.Items[3];
IHierarchy herarchy = null;
if (dimension.ItemType == ItemTypes.Dimension)
{
herarchy = ((Dimension)dimension.DataObject).Hierarchies[0];
}
IFilterViewModel fvm = pivotGrid.DataSource.CreateFilterViewModel(herarchy);
pivotGrid.DataSource.Rows.Add(fvm);
Notice the you should browse your own metadata and select the dimension you want to add to the pivotGrid based on user choice from your dropdowns
Regards
Todor