Hi
I want to be able to loop and Drill MemberFilters in my Rows/Columns/Filters in my pivotGrid.
This is my code for doing this:
//Rows for (int i = 0; i < pivotGrid.DataSource.Rows.Count; i++) { IFilterViewModel fvm = pivotGrid.DataSource.Rows[i] as IFilterViewModel; if (fvm != null && fvm.FilterMembers != null) { foreach (IFilterMember member in fvm.FilterMembers) { DrillIn(fvm, member, FilterTypes.Rows, 4); } } }
But so far i have only been able to get the loaded dimensions in the pivotGrid LayoutLoaded event. In all other Events the Rows Count = 0.
I have tried all the DataSource events like DimensionsLoaded, SchemaLoaded etc but the Rows are empty.
Is there any way that i can read this in a event that fires only once when completed?
Another Question is:
When setting the Rows Dimension i use these lines:
XmlaDataSource ds = (XmlaDataSource)this.Resources["xf.Database);
//Fill the datasource with Dimensions. ds.Rows = DataSourceBase.GenerateInitialItems(rf.Rows);
But if i debug, the Rows are empty. Is there anyway for me to listen to an event that fires when the loading of all rows is complete?
br
Hi!
I was able to solve my problem when using the event CollectionChanged on DataColumns.
thank you
Torgny,
I am following up to see if you have any further questions or if you were able to resolve this with the information that Matt provided. Let us know if we may be of further assistance.
I have been looking into your enquiry and usually the data is loaded with the data rows, meaning when the Pivot’s DataRows collection changes the cells are loaded in the XamPivotGrid. In order to see check if your DataRows are created for the Rows you have loaded you can check its Tuple’s Membres’ UniqueName matches the one loaded in the GenerateInitialItems method. Here is simple snippet to get you started:
string waitingFor = "[Date].[Calendar]";
public MainWindow()
{
InitializeComponent();
pivotGrid2.DataRows.CollectionChanged += DataRows_CollectionChanged;
(pivotGrid2.DataSource as XmlaDataSource).Rows = DataSourceBase.GenerateInitialItems(waitingFor);
}
void DataRows_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
foreach (PivotDataRow dataRow in sender as PivotDataRowCollection)
if (dataRow.Tuple.Members[0].UniqueName.Contains(waitingFor))
Debug.Write(waitingFor + ": ");
Debug.Write(dataRow.Tuple + " ");
foreach (PivotCell cell in dataRow.Cells)
Debug.Write((cell.Data as Cell).Value + " ");
Debug.WriteLine("");
Let me know, if you need any further assistance with this.