Dears,
Is there any event handler for the pivotgrid scroll?
Thanks,
Hi
Because the thread become too overhead for tracking, please close this thread and post your question about chart scrolling in another thread according the datachart section
Regards
Todor
now i made a converter
Grid grid = GetObject(pivotGrid, "GridControlLayout") as Grid; ScrollBar scroll = grid.Children[2] as ScrollBar; // scroll.Value = size(this.xmZoombar.Range.Minimum); Binding binding = new Binding { Source = this.DataChart, Path = new PropertyPath("HorizontalZoombar.Range.Minimum"), Mode = BindingMode.TwoWay, Converter = new Converter2() }; scroll.SetBinding(ScrollBar.ValueProperty, binding);
public class Converter2 : IValueConverter { #region IValueConverter Members public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { // PivotRowHeaderCellControl cellControl = value as PivotRowHeaderCellControl; // PivotRowHeaderCell cell = cellControl.Cell as PivotRowHeaderCell; double test = 0; if (value != null) { test = Math.Round((double)value* 84); } return (int)(test); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { return (double)value/84; } #endregion }
when i scroll the chart, the grid scroll too and its correct, but when i scroll the grid, nothing happen on the chart.
your help is appreciated
Thanks
I was able to write this
Grid grid = GetObject(pivotGrid, "GridControlLayout") as Grid; ScrollBar scroll = grid.Children[2] as ScrollBar; Binding binding = new Binding { Source = this.DataChart, Path = new PropertyPath("HorizontalZoombar.Range.Minimum"), Mode = BindingMode.TwoWay }; scroll.SetBinding(ScrollBar.ValueProperty, binding);
but the "HorizontalZoombar.Range.Minimum" does not return the index
i have to call the function:
private int size(double min) { double test = Math.Round(min * 84); return (int)(test); }
meaning the index of the columns equals to size(HorizontalZoombar.Range.Minimum),
how can i do that?
ok thanks it worked,
but how can i capture the scroll event, meaning when i scroll the grid, i want to take the value of this scroll
pivotgrid onscroll, is there is something like that?
Because there is a lot of elements in pivotGrid UI tree which are called "HorizontalScrollBar", and the frist one that method finds is not the decired one you can use this code to get the scroll bar:
Grid grid = GetObjectUI(pivotGrid, "GridControlLayout") as Grid; scroll = grid.Children[2] as ScrollBar;
Also the value of this scroll bar is the index of column which is first visible at the moment. This means that you should match your point to column index. For example if you have 30 columns and you want to scroll to point 100,100. you should match this point to column index 15 for example and then set scroll.Value=15.