A utility class that contains cell width and height in a grid
Exemple #1
0
 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();
     }
 }
Exemple #2
0
        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;
        }
Exemple #3
0
        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);
        }
Exemple #4
0
            public void Dispose()
            {
                if (!_suppressNotification && _gridPoints != null)
                {
                    _gridPoints.OnPointChanged();

                    _gridPoints = null;
                }
            }
Exemple #5
0
 public DeferNotification(GridPoints gridPoints, bool suppressNotification)
 {
     _gridPoints           = gridPoints;
     _suppressNotification = suppressNotification;
 }
Exemple #6
0
 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();
     }
 }
Exemple #7
0
            public void Dispose() {
                if (!_suppressNotification && _gridPoints != null) {
                    _gridPoints.OnPointChanged();

                    _gridPoints = null;
                }
            }
Exemple #8
0
 public DeferNotification(GridPoints gridPoints, bool suppressNotification) {
     _gridPoints = gridPoints;
     _suppressNotification = suppressNotification;
 }