public PointAccessor(GridPoints points, ScrollDirection scrollDirection) { if (scrollDirection == ScrollDirection.Horizontal) { // column header xPosition = new Indexer <double>(points.xPosition, NotSupportedSetter); yPosition = new Indexer <double>((i) => (i == 0 ? 0.0 : points.ColumnHeaderHeight), NotSupportedSetter); Width = new Indexer <double>(points.GetWidth, points.SetWidth); Height = new Indexer <double>((i) => points.ColumnHeaderHeight, (i, v) => points.ColumnHeaderHeight = v); } else if (scrollDirection == ScrollDirection.Vertical) { // row header xPosition = new Indexer <double>((i) => (i == 0 ? 0.0 : points.RowHeaderWidth), NotSupportedSetter); yPosition = new Indexer <double>(points.yPosition, NotSupportedSetter); Width = new Indexer <double>((i) => points.RowHeaderWidth, (i, v) => points.RowHeaderWidth = v); Height = new Indexer <double>(points.GetHeight, points.SetHeight); } else if (scrollDirection == ScrollDirection.Both) { // data xPosition = new Indexer <double>(points.xPosition, NotSupportedSetter); yPosition = new Indexer <double>(points.yPosition, NotSupportedSetter); Width = new Indexer <double>(points.GetWidth, points.SetWidth); Height = new Indexer <double>(points.GetHeight, points.SetHeight); } else { throw new NotSupportedException(); } }
internal void Initialize(IGridProvider<string> dataProvider) { if (Points != null) { Points.PointChanged -= Points_PointChanged; } Points = new GridPoints(dataProvider.RowCount, dataProvider.ColumnCount, Data.RenderSize); Points.PointChanged += Points_PointChanged; ColumnHeader.Clear(); RowHeader.Clear(); Data.Clear(); DataProvider = dataProvider; _scroller?.StopScroller(); _scroller = new VisualGridScroller(this); Refresh(); // initial refresh // reset scroll bar position to zero HorizontalScrollBar.Value = HorizontalScrollBar.Minimum; VerticalScrollBar.Value = VerticalScrollBar.Minimum; SetScrollBar(ScrollDirection.Both); CanSort = dataProvider.CanSort; }
internal void Initialize(IGridProvider <string> dataProvider) { if (Points != null) { Points.PointChanged -= Points_PointChanged; } Points = new GridPoints(dataProvider.RowCount, dataProvider.ColumnCount, Data.RenderSize); Points.PointChanged += Points_PointChanged; ColumnHeader.Clear(); RowHeader.Clear(); Data.Clear(); DataProvider = dataProvider; _scroller?.StopScroller(); _scroller = new VisualGridScroller(this); Refresh(); // initial refresh // reset scroll bar position to zero HorizontalScrollBar.Value = HorizontalScrollBar.Minimum; VerticalScrollBar.Value = VerticalScrollBar.Minimum; SetScrollBar(ScrollDirection.Both); }
public void Dispose() { if (!_suppressNotification && _gridPoints != null) { _gridPoints.OnPointChanged(); _gridPoints = null; } }
public DeferNotification(GridPoints gridPoints, bool suppressNotification) { _gridPoints = gridPoints; _suppressNotification = suppressNotification; }
public PointAccessor(GridPoints points, ScrollDirection scrollDirection) { if (scrollDirection == ScrollDirection.Horizontal) { // column header xPosition = new Indexer<double>(points.xPosition, NotSupportedSetter); yPosition = new Indexer<double>((i) => (i == 0 ? 0.0 : points.ColumnHeaderHeight), NotSupportedSetter); Width = new Indexer<double>(points.GetWidth, points.SetWidth); Height = new Indexer<double>((i) => points.ColumnHeaderHeight, (i, v) => points.ColumnHeaderHeight = v); } else if (scrollDirection == ScrollDirection.Vertical) { // row header xPosition = new Indexer<double>((i) => (i == 0 ? 0.0 : points.RowHeaderWidth), NotSupportedSetter); yPosition = new Indexer<double>(points.yPosition, NotSupportedSetter); Width = new Indexer<double>((i) => points.RowHeaderWidth, (i, v) => points.RowHeaderWidth = v); Height = new Indexer<double>(points.GetHeight, points.SetHeight); } else if (scrollDirection == ScrollDirection.Both) { // data xPosition = new Indexer<double>(points.xPosition, NotSupportedSetter); yPosition = new Indexer<double>(points.yPosition, NotSupportedSetter); Width = new Indexer<double>(points.GetWidth, points.SetWidth); Height = new Indexer<double>(points.GetHeight, points.SetHeight); } else { throw new NotSupportedException(); } }