コード例 #1
0
        protected override void DropInColumnGroupsView(
            ColumnGroupsViewDefinition view,
            GridViewColumn column,
            RadPosition dropPosition)
        {
            GridViewDataColumn gridViewDataColumn = column as GridViewDataColumn;

            if (gridViewDataColumn != null)
            {
                if (this.ViewTemplate.AllowColumnReorder && this.GridViewGroupColumn.Group.Groups.Count == 0)
                {
                    GridViewColumnGroupRow row = this.FindRow(view.ColumnGroups, (GridViewColumn)gridViewDataColumn);
                    if (this.GridViewGroupColumn.Group != null && this.GridViewGroupColumn.Group.Rows.Count == 0 && (dropPosition & RadPosition.Bottom) != RadPosition.None)
                    {
                        this.GridViewGroupColumn.Group.Rows.Add(new GridViewColumnGroupRow());
                    }
                    if (this.GridViewGroupColumn.Group != null && this.GridViewGroupColumn.Group.Rows.Count > 0)
                    {
                        if (row != null)
                        {
                            row.ColumnNames.Remove(gridViewDataColumn.Name);
                            if (row.ColumnNames.Count == 0)
                            {
                                this.FindGroup(view.ColumnGroups, row)?.Rows.Remove(row);
                            }
                        }
                        if ((dropPosition & RadPosition.Left) != RadPosition.None)
                        {
                            this.GridViewGroupColumn.Group.Rows[0].ColumnNames.Insert(0, gridViewDataColumn.Name);
                        }
                        else
                        {
                            this.GridViewGroupColumn.Group.Rows[0].ColumnNames.Add(gridViewDataColumn.Name);
                        }
                    }
                }
                if (!column.IsVisible && this.GridViewGroupColumn.Group.Groups.Count == 0)
                {
                    column.IsVisible = true;
                }
                else
                {
                    ColumnGroupRowLayout rowLayout = this.TableElement.ViewElement.RowLayout as ColumnGroupRowLayout;
                    rowLayout.InvalidateLayout();
                    rowLayout.InvalidateRenderColumns();
                    this.TableElement.ViewElement.UpdateRows(true);
                }
            }
            else
            {
                if (!(column is GridViewGroupColumn))
                {
                    return;
                }
                this.DropColumnGroup(view, ((GridViewGroupColumn)column).Group, dropPosition);
            }
        }
コード例 #2
0
 public void Initialize(
     GridViewColumnGroup group,
     GridViewColumnGroupRow row,
     int rowIndex,
     Rectangle bounds)
 {
     this.group    = group;
     this.row      = row;
     this.rowIndex = rowIndex;
     this.Bounds   = (RectangleF)bounds;
 }
コード例 #3
0
        private bool IsLastColumnInRow(GridViewColumnGroupRow row, GridViewColumn column)
        {
            int num1 = 0;
            int num2 = -1;

            foreach (string columnName in (Collection <string>)row.ColumnNames)
            {
                GridViewColumn column1 = (GridViewColumn)this.template.Columns[columnName];
                if (this.owner.ColumnIsVisible(column1) || this.owner.IgnoreColumnVisibility)
                {
                    if (column1 == column)
                    {
                        num2 = num1;
                    }
                    ++num1;
                }
            }
            return(num2 == num1 - 1);
        }
コード例 #4
0
        private SizeF ArrangeGroupRow(
            GridViewColumnGroupRow row,
            ColumnGroupLayoutNode node,
            PointF location,
            float availableWidth)
        {
            float num1 = 0.0f;

            foreach (string columnName in (Collection <string>)row.ColumnNames)
            {
                GridViewColumn column = (GridViewColumn)this.template.Columns[columnName];
                if (this.owner.ColumnIsVisible(column) || this.owner.IgnoreColumnVisibility)
                {
                    ColumnGroupColumnData columnGroupColumnData = node.ColumnData[column];
                    num1 += columnGroupColumnData.OriginalWidth;
                }
            }
            float num2 = 0.0f;
            float num3 = (float)row.MinHeight;

            foreach (string columnName in (Collection <string>)row.ColumnNames)
            {
                GridViewColumn column = (GridViewColumn)this.template.Columns[columnName];
                if (this.owner.ColumnIsVisible(column) || this.owner.IgnoreColumnVisibility)
                {
                    ColumnGroupColumnData columnGroupColumnData = node.ColumnData[column];
                    if (this.resizedColumn != column)
                    {
                        columnGroupColumnData.Bounds.Width = columnGroupColumnData.GetConstrainedWidth(columnGroupColumnData.OriginalWidth * availableWidth / num1);
                    }
                    columnGroupColumnData.Bounds.Location = new PointF(location.X + num2, location.Y);
                    columnGroupColumnData.Bounds.Height   = (float)column.RowSpan;
                    num2           += columnGroupColumnData.Bounds.Width;
                    num3            = Math.Max(num3, columnGroupColumnData.Bounds.Height);
                    num1           -= columnGroupColumnData.OriginalWidth;
                    availableWidth -= columnGroupColumnData.Bounds.Width;
                    if (column is GridViewDataColumn)
                    {
                        this.SetColumnWidthInternal(column, (int)columnGroupColumnData.Bounds.Width);
                    }
                }
            }
            float width1 = 0.0f;

            foreach (string columnName in (Collection <string>)row.ColumnNames)
            {
                GridViewColumn column = (GridViewColumn)this.template.Columns[columnName];
                if (this.owner.ColumnIsVisible(column) || this.owner.IgnoreColumnVisibility)
                {
                    ColumnGroupColumnData columnGroupColumnData = node.ColumnData[column];
                    if (this.resizedColumn != column)
                    {
                        float width2 = columnGroupColumnData.Bounds.Width;
                        columnGroupColumnData.Bounds.Width = columnGroupColumnData.GetConstrainedWidth(columnGroupColumnData.Bounds.Width + availableWidth);
                        availableWidth -= columnGroupColumnData.Bounds.Width - width2;
                    }
                    columnGroupColumnData.Bounds.Location = new PointF(location.X + width1, location.Y);
                    width1 += columnGroupColumnData.Bounds.Width;
                    if (column is GridViewDataColumn)
                    {
                        column.SuspendPropertyNotifications();
                        this.SetColumnWidthInternal(column, (int)columnGroupColumnData.Bounds.Width);
                        column.ResumePropertyNotifications();
                    }
                }
            }
            return(new SizeF(width1, num3));
        }