예제 #1
0
        private void ScrollRows(GridTableElement tableElement, Point location)
        {
            ScrollableRowsContainerElement scrollableRows    = tableElement.ViewElement.ScrollableRows;
            RadScrollBarElement            veritcalScrollbar = this.GetVeritcalScrollbar(tableElement);
            Rectangle boundingRectangle = scrollableRows.ControlBoundingRectangle;

            if (boundingRectangle.Contains(location) || location.X < boundingRectangle.X || location.X > boundingRectangle.Right)
            {
                return;
            }
            int num = 0;

            if (location.Y > boundingRectangle.Bottom)
            {
                num = location.Y - boundingRectangle.Bottom;
            }
            else if (location.Y < boundingRectangle.Y)
            {
                num = location.Y - boundingRectangle.Y;
            }
            if (num == 0 || veritcalScrollbar.Visibility != ElementVisibility.Visible)
            {
                return;
            }
            veritcalScrollbar.Value = this.ClampValue(veritcalScrollbar.Value + num, veritcalScrollbar.Minimum, veritcalScrollbar.Maximum - veritcalScrollbar.LargeChange + 1);
        }
예제 #2
0
        private Rectangle GetScrollableColumnBounds(GridTableElement tableElement)
        {
            PinnedRowsContainerElement     topPinnedRows    = tableElement.ViewElement.TopPinnedRows;
            ScrollableRowsContainerElement scrollableRows   = tableElement.ViewElement.ScrollableRows;
            PinnedRowsContainerElement     bottomPinnedRows = tableElement.ViewElement.BottomPinnedRows;
            RadElement radElement = (RadElement)null;

            if (topPinnedRows.Children.Count > 0)
            {
                radElement = (RadElement)topPinnedRows;
            }
            else if (scrollableRows.Children.Count > 0)
            {
                radElement = (RadElement)scrollableRows;
            }
            else if (bottomPinnedRows.Children.Count > 0)
            {
                radElement = (RadElement)bottomPinnedRows;
            }
            if (radElement == null)
            {
                return(Rectangle.Empty);
            }
            Rectangle boundingRectangle = (radElement.Children[0] as GridVirtualizedRowElement).ScrollableColumns.ControlBoundingRectangle;

            if (tableElement.VScrollBar.Visibility != ElementVisibility.Collapsed)
            {
                boundingRectangle.Width -= tableElement.VScrollBar.ControlBoundingRectangle.Width;
            }
            if (tableElement.HScrollBar.Visibility != ElementVisibility.Collapsed)
            {
                boundingRectangle.Height -= tableElement.HScrollBar.ControlBoundingRectangle.Height;
            }
            return(boundingRectangle);
        }
예제 #3
0
        protected virtual bool TryEnsureRowVisibilityByTraverser(
            GridViewRowInfo rowInfo,
            bool isLastRow,
            RadScrollBarElement verticalScrollBar,
            ScrollableRowsContainerElement scrollableRows,
            out GridRowElement row,
            out bool isTraverserd)
        {
            int num = verticalScrollBar.Maximum - verticalScrollBar.LargeChange + 1;

            if (isLastRow && num != verticalScrollBar.Value)
            {
                this.ChangeScrollbarValue(verticalScrollBar, num);
                this.UpdateLayout();
            }
            row          = this.GetRowElement(rowInfo);
            isTraverserd = false;
            if (row != null)
            {
                return(false);
            }
            int height = (int)this.RowScroller.ElementProvider.GetElementSize(rowInfo).Height;

            this.EnsureScrollingDelta(rowInfo, isLastRow, ref height);
            if (this.UseScrollbarsInHierarchy && scrollableRows.Children.Count > 0)
            {
                GridDetailViewRowElement child = scrollableRows.Children[scrollableRows.Children.Count - 1] as GridDetailViewRowElement;
                height += child != null ? child.RowInfo.Height - child.Size.Height : 0;
            }
            isTraverserd = this.EnsureRowVisibleByTraverser(verticalScrollBar, rowInfo, (float)height);
            return(true);
        }
예제 #4
0
        private bool EnsureRowVisibleByTraverserDown(
            RadScrollBarElement vScrollBar,
            GridViewRowInfo rowInfo,
            ScrollableRowsContainerElement rows,
            float delta)
        {
            GridRowElement child      = (GridRowElement)rows.Children[rows.Children.Count - 1];
            GridTraverser  enumerator = (GridTraverser)((IEnumerable)this.RowScroller).GetEnumerator();

            while (enumerator.Current is GridViewDetailsRowInfo)
            {
                enumerator.MoveNext();
            }
            enumerator.MovePrevious();
            if (enumerator.Current == rowInfo)
            {
                return(this.ChangeScrollbarValue(vScrollBar, vScrollBar.Value - (int)delta));
            }
            do
            {
                ;
            }while (enumerator.MoveNext() && enumerator.Current != child.RowInfo);
            enumerator.MoveNext();
            if (enumerator.Current == rowInfo)
            {
                return(this.ChangeScrollbarValue(vScrollBar, vScrollBar.Value + (int)delta));
            }
            return(false);
        }
예제 #5
0
        protected virtual bool EnsureRowVisibleCore(GridViewRowInfo rowInfo)
        {
            bool           isTraverserd = false;
            bool           isLastRow    = false;
            bool           isFirstRow   = false;
            GridRowElement row          = this.GetRowElement(rowInfo);

            this.DetermineScrollableRowPosition(rowInfo, out isFirstRow, out isLastRow);
            ScrollableRowsContainerElement scrollableRows   = this.ViewElement.ScrollableRows;
            RadScrollBarElement            vericalScrollBar = this.UseScrollbarsInHierarchy ? this.VScrollBar : this.MasterVScrollBar;

            if (row == null && this.TryEnsureRowVisibilityByTraverser(rowInfo, isLastRow, vericalScrollBar, scrollableRows, out row, out isTraverserd))
            {
                return(isTraverserd);
            }
            RectangleF boundingRectangle1   = (RectangleF)this.MasterTableElement.ViewElement.ScrollableRows.ControlBoundingRectangle;
            RectangleF innerClientRectangle = this.GetInnerClientRectangle(rowInfo);
            Rectangle  boundingRectangle2   = row.ControlBoundingRectangle;
            int        scrollValue          = vericalScrollBar.Value;

            if (this.GridViewElement.SplitMode != RadGridViewSplitMode.None && this.MasterTableElement != row.TableElement)
            {
                return(false);
            }
            if ((double)boundingRectangle2.Bottom > (double)boundingRectangle1.Bottom || (double)boundingRectangle2.Bottom > (double)innerClientRectangle.Bottom)
            {
                this.EnsureRowVisibilityAtBottom(rowInfo, isLastRow, (RectangleF)boundingRectangle2, innerClientRectangle, ref vericalScrollBar, ref scrollValue);
            }
            else if ((double)boundingRectangle2.Y < (double)boundingRectangle1.Y || this.ParentHScrollBar.Visibility == ElementVisibility.Visible && this.ParentHScrollBar.ControlBoundingRectangle.IntersectsWith(boundingRectangle2) || this.UseScrollbarsInHierarchy && (double)boundingRectangle2.Y < (double)innerClientRectangle.Y)
            {
                this.EnsureRowVisibilityAtTop((RectangleF)boundingRectangle2, boundingRectangle1, innerClientRectangle, ref vericalScrollBar, ref scrollValue);
            }
            return(this.ChangeScrollbarValue(vericalScrollBar, scrollValue));
        }
예제 #6
0
        protected GridViewRowInfo GetLastScrollableRow(GridTableElement tableElement)
        {
            ScrollableRowsContainerElement scrollableRows = tableElement.ViewElement.ScrollableRows;
            GridTraverser enumerator = (GridTraverser)((IEnumerable)tableElement.RowScroller).GetEnumerator();
            int           index      = 0;

            while (index < scrollableRows.Children.Count && (scrollableRows.Children[index].BoundingRectangle.Bottom <= scrollableRows.Size.Height && enumerator.MoveNext()))
            {
                ++index;
            }
            return(enumerator.Current);
        }
예제 #7
0
        protected GridViewRowInfo GetFirstScrollableRow(
            GridTableElement tableElement,
            bool checkBounds)
        {
            ScrollableRowsContainerElement scrollableRows = tableElement.ViewElement.ScrollableRows;
            GridTraverser enumerator = (GridTraverser)((IEnumerable)tableElement.RowScroller).GetEnumerator();

            if (enumerator.Current == null)
            {
                enumerator.MoveNext();
            }
            return(enumerator.Current);
        }
예제 #8
0
        protected virtual bool EnsureRowVisibleByTraverser(
            RadScrollBarElement vScrollBar,
            GridViewRowInfo rowInfo,
            float delta)
        {
            ScrollableRowsContainerElement scrollableRows = this.ViewElement.ScrollableRows;
            RadElementCollection           children       = scrollableRows.Children;
            int num1 = vScrollBar.Maximum - vScrollBar.LargeChange + 1;

            while (vScrollBar.Maximum != 0 && children.Count == 0)
            {
                this.ChangeScrollbarValue(vScrollBar, vScrollBar.Value + 1);
                this.UpdateLayout();
                if (scrollableRows.Children.Count > 0 || vScrollBar.Value == num1 || vScrollBar.Value == vScrollBar.Maximum)
                {
                    break;
                }
            }
            if (children.Count == 0)
            {
                return(false);
            }
            if (this.EnsureRowVisibleByTraverserDown(vScrollBar, rowInfo, scrollableRows, delta))
            {
                return(true);
            }
            GridRowElement child = (GridRowElement)scrollableRows.Children[0];

            if (((GridTraverser)((IEnumerable)this.RowScroller).GetEnumerator()).Current == rowInfo)
            {
                int num2 = vScrollBar.Value - (int)delta;
                if (num2 < vScrollBar.Minimum)
                {
                    num2 = vScrollBar.Minimum;
                }
                else if (num2 > vScrollBar.Maximum)
                {
                    num2 = vScrollBar.Maximum;
                }
                return(this.ChangeScrollbarValue(vScrollBar, num2));
            }
            GridViewGroupRowInfo parent = rowInfo.Parent as GridViewGroupRowInfo;

            if (parent != null && !parent.IsExpanded)
            {
                return(false);
            }
            return(this.RowScroller.ScrollToItem(rowInfo, false));
        }
        private void CorrectScrollbarRangeInHierarchy()
        {
            GridTableElement       tableElement    = ((RowsContainerElement)this.Parent).TableElement;
            RadGridViewElement     gridViewElement = tableElement.GridViewElement;
            RadScrollBarElement    vscrollBar      = tableElement.VScrollBar;
            MasterGridViewTemplate masterTemplate  = tableElement.MasterTemplate;

            if (masterTemplate == null || masterTemplate.Templates.Count == 0 || (gridViewElement.UseScrollbarsInHierarchy || tableElement.ViewInfo.ParentRow != null) || (this.Children.Count == 0 || vscrollBar.Value < vscrollBar.Maximum - vscrollBar.LargeChange + 1))
            {
                return;
            }
            GridDetailViewRowElement child1 = this.Children[this.Children.Count - 1] as GridDetailViewRowElement;

            if (child1 == null || child1.ContentCell.ChildTableElement.ViewInfo == null)
            {
                return;
            }
            ScrollableRowsContainerElement scrollableRows = child1.ContentCell.ChildTableElement.ViewElement.ScrollableRows;
            int           count         = scrollableRows.Children.Count;
            GridTraverser gridTraverser = new GridTraverser(child1.ContentCell.ChildTableElement.ViewInfo);

            gridTraverser.TraversalMode = GridTraverser.TraversalModes.ScrollableRows;
            int num1 = 0;

            while (gridTraverser.MoveNext())
            {
                ++num1;
                if (num1 > count)
                {
                    int height = (int)child1.ContentCell.ChildTableElement.RowElementProvider.GetElementSize(gridTraverser.Current).Height;
                    tableElement.RowScroller.UpdateScrollRange(vscrollBar.Maximum + height, false);
                    return;
                }
            }
            if (scrollableRows.Children.Count <= 0)
            {
                return;
            }
            GridRowElement child2 = (GridRowElement)scrollableRows.Children[scrollableRows.Children.Count - 1];

            if (child2.ControlBoundingRectangle.Bottom <= scrollableRows.ControlBoundingRectangle.Bottom)
            {
                return;
            }
            int num2 = child2.ControlBoundingRectangle.Bottom - scrollableRows.ControlBoundingRectangle.Bottom;

            tableElement.RowScroller.UpdateScrollRange(vscrollBar.Maximum + num2, false);
        }
예제 #10
0
        protected override void CreateChildElements()
        {
            base.CreateChildElements();
            ChildrenChangedEventHandler changedEventHandler = new ChildrenChangedEventHandler(this.rows_ChildrenChanged);

            this.topPinnedRows                  = new PinnedRowsContainerElement();
            this.topPinnedRows.ZIndex           = 10;
            this.topPinnedRows.ChildrenChanged += changedEventHandler;
            this.Children.Add((RadElement)this.topPinnedRows);
            this.scrollableRows = new ScrollableRowsContainerElement();
            this.scrollableRows.ChildrenChanged += changedEventHandler;
            this.Children.Add((RadElement)this.scrollableRows);
            this.bottomPinnedRows                  = new PinnedRowsContainerElement();
            this.bottomPinnedRows.ZIndex           = 5;
            this.bottomPinnedRows.ChildrenChanged += changedEventHandler;
            this.Children.Add((RadElement)this.bottomPinnedRows);
        }