Hi,
I modified the pivotGrid DataSource and did a RefreshGrid.
After refresh I can't scroll through all my items in the grid. The scrollbar changed and lets me scroll through only some of the items.
Looks like a bug.
Could you please suggest a work around.
Hello,
Could you specify how exactly you have modified the DataSource? Basically there are very rare cases where you have to call RefreshGrid on yourself because both the data source and the pivot grid keep attention to changes and they do that internally.Regards.Plamen.
Hi Plamen,
Here is something else I noticed:
When I comment out tree expansion code and hiding totals code in LayoutLoaded event, then the scrolling seems fine. Although I can't seem to expand the Date Hierarchy Row.
Is there a better event to expand tree and hide totals?
private void PivotGrid_LayoutLoaded(object sender, EventArgs e) { // Turn off col totals foreach (PivotDataColumn col in pivotGrid.DataColumns) { if (col.IsTotal) col.IsVisible = false; } // Turn off row totals foreach (PivotDataRow row in pivotGrid.DataRows) { if (row.IsTotal) row.IsVisible = false; } // Expand Column Hierarchy foreach (PivotHeaderCell cell in pivotGrid.GridLayout.ColumnHeaderCells) { if (cell.IsToggleVisible && cell.IsExpanded == false) { cell.IsExpanded = true; return; } } // Expand Row Hierarchy foreach (PivotHeaderCell cell in pivotGrid.GridLayout.RowHeaderCells) { if (cell.IsToggleVisible && cell.IsExpanded == false) { cell.IsExpanded = true; return; } } }
Thanks
Sangeetha
I modified the Pivot Grid's FlatDataSource as follows:
FlatDataSource fds = pivotGrid.DataSource as FlatDataSource; Type t = fds.ItemsSource.GetType(); counter = 0; IEnumerator enumerator = fds.ItemsSource.GetEnumerator(); while (enumerator.MoveNext()) { Type type = enumerator.Current.GetType(); string indexName = type.GetProperty("Index Name").GetValue(enumerator.Current, null) as string; if (indexName.Equals(selectedIndex)) { double dval = 0; try { object oval = type.GetProperty(selectedValueColumn).GetValue(enumerator.Current, null); dval = double.Parse(oval.ToString()); } catch (Exception ex) { } type.GetProperty(selectedValueColumn).SetValue(enumerator.Current, dval + shift + (step * counter++), null); } }
It seems to sometimes refresh it, but not always unless I Refresh.
Also noticed that this is not the cause for the scrollbar not showing the entire contents of the grid.