Dears,
Is there any event handler for the pivotgrid scroll?
Thanks,
hi
I am trying to bind the scroll of the datachart with the scroll of the grid
private void OnXamDataChartWindowRectChanged(object sender, RectChangedEventArgs e) { if (IsZoombarChanging) return; try { IsZoombarChanging = true; Range newZoombarRange = new Range { Minimum = e.NewRect.X, Maximum = e.NewRect.X + e.NewRect.Width }; if (this.xmZoombar != null) { this.xmZoombar.Range = newZoombarRange; } // this.pivotGrid.ScrollCellIntoView(this.pivotGrid.DataRows[0].Cells[size(newZoombarRange.Maximum)-1]); ScrollBar horiz = GetObject(pivotGrid, "HorizontalScrollBar") as ScrollBar; if (horiz != null) { horiz.Value = size(newZoombarRange.Maximum); } } finally { IsZoombarChanging = false; } }
when i am using the ScrollCellIntoView , it working, but when using the horiz.value its not.
i want also to capture the horizontal scroll value of the grid, so that when i scroll the grid, i would be able to scroll the chart too.
Hi
use horiz.Value=xxx'
Todor
Hi,
after capturing the scroll of the grid, i want to scroll it to certain point
ScrollBar horiz = GetObject(pivotGrid, "HorizontalScrollBar") as ScrollBar; if (horiz != null) { horiz.Minimum = e.NewRect.X; horiz.Maximum = e.NewRect.X + e.NewRect.Width; }how to regive the grid the new scroll, or attache the grid to this scroll??
There is not scroll event but you can find the scroll bar from control and to listen for thier scroll event. Below is a snippet how to find the scroll bar. The names of the bars you can see from generic.xaml from pivotgrid control template.
void PivotGridContainer_Loaded(object sender, RoutedEventArgs e) { ScrollBar vert = GetObject(PGrid, "VerticalScrollBar") as ScrollBar; ScrollBar horiz = GetObject(PGrid, "HorizontalScrollBar") as ScrollBar; } private DependencyObject GetObject(DependencyObject obj, string name) { DependencyObject child = null; int coutn = VisualTreeHelper.GetChildrenCount(obj); for (int index = 0; index < coutn; index++) { child = VisualTreeHelper.GetChild(obj, index); if (child is FrameworkElement && (child as FrameworkElement).Name == name) { return child; } child = GetObject(child, name); if (child != null) { return child; } } return child; }
ScrollBar vert = GetObject(PGrid, "VerticalScrollBar") as ScrollBar; ScrollBar horiz = GetObject(PGrid, "HorizontalScrollBar") as ScrollBar;