public virtual bool IsCompatible(GridViewColumn data, object context)
        {
            GridVirtualizedRowElement virtualizedRowElement = context as GridVirtualizedRowElement;

            if (virtualizedRowElement == null)
            {
                return(false);
            }
            return(data.GetCellType(virtualizedRowElement.RowInfo).IsAssignableFrom(this.GetType()));
        }
Esempio n. 2
0
 private void ColumnScroller_ScrollerUpdated(object sender, EventArgs e)
 {
     this.RowLayout.EnsureColumnsLayout();
     foreach (GridRowElement visualRow in (IEnumerable <GridRowElement>) this.TableElement.VisualRows)
     {
         GridVirtualizedRowElement virtualizedRowElement = visualRow as GridVirtualizedRowElement;
         if (virtualizedRowElement != null)
         {
             virtualizedRowElement.ScrollableColumns.ScrollOffset = new SizeF((float)-this.TableElement.ColumnScroller.ScrollOffset, 0.0f);
             virtualizedRowElement.ScrollableColumns.UpdateItems();
         }
     }
     this.oldHScrollValue = this.TableElement.ColumnScroller.Scrollbar.Value;
 }
Esempio n. 3
0
        public override IVirtualizedElement <GridViewRowInfo> GetElement(
            GridViewRowInfo data,
            object context)
        {
            if (data.ViewTemplate.ColumnCount == 0)
            {
                return((IVirtualizedElement <GridViewRowInfo>)null);
            }
            IVirtualizedElement <GridViewRowInfo> element = base.GetElement(data, context);
            GridVirtualizedRowElement             virtualizedRowElement = element as GridVirtualizedRowElement;

            if (virtualizedRowElement != null)
            {
                virtualizedRowElement.ScrollableColumns.ScrollOffset = new SizeF((float)-this.rowView.ColumnScroller.ScrollOffset, 0.0f);
            }
            return(element);
        }
        public int IndexOf(GridCellElement item)
        {
            if (this.row == null)
            {
                return(-1);
            }
            if (!(this.row is GridVirtualizedRowElement))
            {
                return(this.row.Children.IndexOf((RadElement)item));
            }
            GridVirtualizedRowElement row = (GridVirtualizedRowElement)this.row;

            if (item.ColumnInfo.PinPosition == PinnedColumnPosition.Left)
            {
                for (int index = 0; index < row.LeftPinnedColumns.Children.Count; ++index)
                {
                    if (row.LeftPinnedColumns.Children[index] == item)
                    {
                        return(index);
                    }
                }
                return(-1);
            }
            if (item.ColumnInfo.PinPosition == PinnedColumnPosition.Right)
            {
                for (int index = 0; index < row.RightPinnedColumns.Children.Count; ++index)
                {
                    if (row.RightPinnedColumns.Children[index] == item)
                    {
                        return(index + row.LeftPinnedColumns.Children.Count + row.ScrollableColumns.Children.Count);
                    }
                }
                return(-1);
            }
            for (int index = 0; index < row.ScrollableColumns.Children.Count; ++index)
            {
                if (row.ScrollableColumns.Children[index] == item)
                {
                    return(index + row.LeftPinnedColumns.Children.Count);
                }
            }
            return(-1);
        }
Esempio n. 5
0
        private void Detach(
            IVirtualizedElementProvider <GridViewRowInfo> rowElementProvider,
            GridRowElement row)
        {
            GridVirtualizedRowElement virtualizedRowElement = row as GridVirtualizedRowElement;

            if (virtualizedRowElement != null)
            {
                rowElementProvider.CacheElement((IVirtualizedElement <GridViewRowInfo>)virtualizedRowElement);
                virtualizedRowElement.Detach();
                if (virtualizedRowElement.Parent == null || !virtualizedRowElement.Parent.Children.Contains((RadElement)virtualizedRowElement))
                {
                    return;
                }
                virtualizedRowElement.Parent.Children.Remove((RadElement)virtualizedRowElement);
            }
            else
            {
                row.Dispose();
            }
        }
 public GridCellElement this[int index]
 {
     get
     {
         if (this.row == null)
         {
             return((GridCellElement)null);
         }
         if (index < 0)
         {
             return((GridCellElement)null);
         }
         GridVirtualizedRowElement row = this.row as GridVirtualizedRowElement;
         if (row == null)
         {
             return((GridCellElement)this.row.Children[index]);
         }
         int count1 = row.LeftPinnedColumns.Children.Count;
         if (index < count1)
         {
             return((GridCellElement)row.LeftPinnedColumns.Children[index]);
         }
         int count2 = row.ScrollableColumns.Children.Count;
         index -= count1;
         if (index < count2)
         {
             return((GridCellElement)row.ScrollableColumns.Children[index]);
         }
         index -= count2;
         if (index < row.RightPinnedColumns.Children.Count)
         {
             return((GridCellElement)row.RightPinnedColumns.Children[index]);
         }
         return((GridCellElement)null);
     }
     set
     {
         throw new NotImplementedException();
     }
 }
Esempio n. 7
0
 public void UpdateRows(bool updateCells)
 {
     if (updateCells)
     {
         this.RowLayout.InvalidateLayout();
         foreach (GridRowElement visualRow in (IEnumerable <GridRowElement>) this.TableElement.VisualRows)
         {
             GridVirtualizedRowElement virtualizedRowElement = visualRow as GridVirtualizedRowElement;
             if (virtualizedRowElement != null)
             {
                 virtualizedRowElement.LeftPinnedColumns.UpdateItems();
                 virtualizedRowElement.ScrollableColumns.UpdateItems();
                 virtualizedRowElement.RightPinnedColumns.UpdateItems();
             }
         }
     }
     this.RowLayout.EnsureColumnsLayout();
     this.TopPinnedRows.UpdateItems();
     this.ScrollableRows.UpdateItems();
     this.BottomPinnedRows.UpdateItems();
     this.InvalidateMeasure();
 }
Esempio n. 8
0
        public virtual bool EnsureCellVisible(GridViewRowInfo rowInfo, GridViewColumn column)
        {
            if (!this.TableElement.ElementTree.Control.Visible || this.TableElement.ElementTree.Control.Size == Size.Empty)
            {
                return(false);
            }
            this.EnsureRowVisible(rowInfo);
            GridRowElement rowElement = this.GetRowElement(rowInfo);

            if (rowElement == null || column == null || (!column.IsVisible || column.IsGrouped) || column.OwnerTemplate.Parent == null && column.IsPinned)
            {
                return(false);
            }
            Rectangle empty     = Rectangle.Empty;
            Rectangle rectangle = rowInfo.PinPosition != PinnedRowPosition.Top ? (rowInfo.PinPosition != PinnedRowPosition.Bottom ? this.ViewElement.ScrollableRows.ControlBoundingRectangle : this.ViewElement.BottomPinnedRows.ControlBoundingRectangle) : this.ViewElement.TopPinnedRows.ControlBoundingRectangle;
            bool      flag1     = rowElement.ElementTree.Control.RightToLeft == RightToLeft.Yes;
            GridVirtualizedRowElement virtualizedRowElement = rowElement as GridVirtualizedRowElement;

            if (virtualizedRowElement != null)
            {
                rectangle.X = virtualizedRowElement.ScrollableColumns.ControlBoundingRectangle.X;
                if (flag1)
                {
                    rectangle.X -= virtualizedRowElement.TableElement.CellSpacing;
                }
                rectangle.Width = virtualizedRowElement.ScrollableColumns.ControlBoundingRectangle.Width;
            }
            foreach (GridCellElement visualCell in rowElement.VisualCells)
            {
                if ((visualCell.ColumnInfo == null || !visualCell.ColumnInfo.IsPinned) && visualCell.ColumnInfo == column)
                {
                    if (visualCell.ControlBoundingRectangle.Width > rectangle.Width)
                    {
                        return(false);
                    }
                    if (visualCell.ControlBoundingRectangle.Right > rectangle.Right + 1)
                    {
                        if (this.TableElement.ColumnScroller.ScrollMode == ItemScrollerScrollModes.Discrete)
                        {
                            int num1 = this.ColumnScroller.Scrollbar.Maximum - this.ColumnScroller.Scrollbar.LargeChange + 1;
                            int num2 = column.Index;
                            if (num2 > num1)
                            {
                                num2 = num1;
                            }
                            this.ColumnScroller.Scrollbar.Value = num2;
                        }
                        else
                        {
                            int num = visualCell.ControlBoundingRectangle.Right - rectangle.Right;
                            if (flag1)
                            {
                                num *= -1;
                            }
                            this.ChangeScrollbarValue(this.ColumnScroller.Scrollbar, this.ColumnScroller.Scrollbar.Value + num);
                        }
                    }
                    if (visualCell.ControlBoundingRectangle.X < rectangle.X - 1)
                    {
                        if (this.TableElement.ColumnScroller.ScrollMode == ItemScrollerScrollModes.Discrete)
                        {
                            int num1 = this.ColumnScroller.Scrollbar.Maximum - this.ColumnScroller.Scrollbar.LargeChange + 1;
                            int num2 = column.Index;
                            if (num2 > num1)
                            {
                                num2 = num1;
                            }
                            this.ColumnScroller.Scrollbar.Value = num2;
                        }
                        else
                        {
                            int num = visualCell.ControlBoundingRectangle.X - rectangle.X;
                            if (flag1)
                            {
                                num *= -1;
                            }
                            this.ChangeScrollbarValue(this.ColumnScroller.Scrollbar, this.ColumnScroller.Scrollbar.Value + num);
                        }
                    }
                    return(true);
                }
            }
            if (rowInfo is GridViewGroupRowInfo)
            {
                return(false);
            }
            ColumnGroupRowLayout rowLayout = this.TableElement.ViewElement.RowLayout as ColumnGroupRowLayout;

            if (rowLayout != null)
            {
                this.ChangeScrollbarValue(this.ColumnScroller.Scrollbar, rowLayout.GetColumnOffset(column));
                return(true);
            }
            int  num3 = this.ColumnScroller.Scrollbar.Value;
            bool flag2;

            if (this.TableElement.ColumnScroller.ScrollMode == ItemScrollerScrollModes.Discrete)
            {
                int num1 = this.ColumnScroller.Scrollbar.Maximum - this.ColumnScroller.Scrollbar.LargeChange + 1;
                int num2 = column.Index;
                if (num2 > num1)
                {
                    num2 = num1;
                }
                this.ColumnScroller.Scrollbar.Value = num2;
                this.TableElement.Invalidate();
                flag2 = true;
            }
            else
            {
                flag2 = this.ColumnScroller.ScrollToItem(column, false);
            }
            if (num3 < this.ColumnScroller.Scrollbar.Value)
            {
                this.UpdateLayout();
                foreach (GridCellElement visualCell in rowElement.VisualCells)
                {
                    if ((visualCell.ColumnInfo == null || !visualCell.ColumnInfo.IsPinned) && visualCell.ColumnInfo == column)
                    {
                        this.ChangeScrollbarValue(this.ColumnScroller.Scrollbar, this.ColumnScroller.Scrollbar.Value + (flag1 ? rectangle.Left - visualCell.ControlBoundingRectangle.Left : visualCell.ControlBoundingRectangle.Right - rectangle.Right));
                    }
                }
            }
            return(flag2);
        }