I need to know how I can define rows, columns, filters and measures like you in the xaml below through code.
I need to bind to each property and due to the fact that those are not DependencyObjects I need to listen to the propertychanged of my viewmodel and set those manually. Unfortunatly I cannot find out how to add rows, measures, filters etc. to the datasource through code.
Please let me know. This is very urgent.
<olap:XmlaDataSource x:Key="DataSource" Columns="[Date].[Calendar]" Cube="Adventure Works" Database="Adventure Works DW Standard Edition" Filters="[Sales Territory].[Sales Territory Country]{[Sales Territory].[Sales Territory Country].&[United Kingdom]}" Measures="Reseller Sales Amount" Rows="[Geography].[City]" >
Hello,
You can add columns/rows/filters/measures using this code:
pivotGrid.DataSource.DeferredLayoutUpdate = true;
IMeasure measure = pivotGrid.DataSource.Cube.Measures["Reseller Sales Amount"];
IMeasureViewModel measureViewModel = pivotGrid.DataSource.CreateMeasureViewModel(measure);
pivotGrid.DataSource.Measures.Add(measureViewModel);
IDimension dateDimension = pivotGrid.DataSource.Cube.Dimensions["[Date]"];
IHierarchy dateCalendarHierarchy = dateDimension.Hierarchies["[Date].[Calendar]"];
IFilterViewModel columnViewModel = pivotGrid.DataSource.CreateFilterViewModel(dateCalendarHierarchy);
pivotGrid.DataSource.Columns.Add(columnViewModel);
// updates grid layout
pivotGrid.DataSource.DeferredLayoutUpdate = false;
Regards.Plamen.