Hi,
DataSourceBase.GenerateInitialItems is used to set intial values on Cube, Measures, Rows, and Columns properties.
I would like to subsequently change the Rows or Column property to a new value via code. However, when I assign the property a second time using GenerateInitialItems it appears to have no effect.
Thanks,
Gary
Hello Gary,
I have been looking into your issue and I can suggest you add the new dimensions directly in the DataSource Columns collection instead of using the method GenerateInitialItems:
var DataSource = this.xamPivotGrid.DataSource;
IHierarchy hierarchy = DataSource.Cube.Dimensions["Customer"].Hierarchies[0];
IFilterViewModel filterViewModel = DataSource.CreateFilterViewModel(hierarchy);
DataSource.Columns.Clear();
DataSource.Columns.Add(filterViewModel);
For additional reference please check the section “From Code-behind During Runtime” from the following link form our documentation:
http://help.infragistics.com/NetAdvantage/WPFDV/2011.2/CLR4.0/?page=xamPivotGrid_US_Assigning_Hierarchies_And_Measures.html
Please let me know if you need any additional assistance on this matter.
Thank you for your help! May I ask for your assistance with a slightly more complex example?
I would like to change the Rows at run-time to the following:
"[Date].[Calendar]{[Date].[Calendar].[Date].&[20080701], [Date].[Calendar].[Date].&[20080702]}"
I see how to specify the hierarchy, but I am not clear how to specify the item filter (the two dates).
Also, what event handler do you recommend I put this in so that I don't attempt to access the dimensions before they are loaded?
Thank you,