Esempio n. 1
0
        internal void SetPinPosition(
            GridViewColumnGroup group,
            PinnedColumnPosition position,
            GridViewTemplate template)
        {
            group.pinPosition = position;
            group.OnNotifyPropertyChanged("PinPosition");
            foreach (GridViewColumnGroup group1 in (Collection <GridViewColumnGroup>)group.Groups)
            {
                this.SetPinPosition(group1, position, template);
            }
            if (template == null || group.Groups.Count != 0)
            {
                return;
            }
            foreach (GridViewColumnGroupRow row in (Collection <GridViewColumnGroupRow>)group.Rows)
            {
                foreach (string columnName in (Collection <string>)row.ColumnNames)
                {
                    GridViewColumn column = (GridViewColumn)template.Columns[columnName];
                    column.SuspendPropertyNotifications();
                    column.PinPosition = position;
                    column.ResumePropertyNotifications();
                }
            }
            if (this.IsSuspended || template == null)
            {
                return;
            }
            PropertyChangedEventArgs changedEventArgs = new PropertyChangedEventArgs("PinPosition");

            template.OnViewChanged((object)this, new DataViewChangedEventArgs(ViewChangedAction.ColumnGroupPropertyChanged, (object)changedEventArgs));
        }
 private void SetColumnWidthInternal(GridViewColumn column, int width)
 {
     if (!this.owner.IsResizeInProgress)
     {
         column.SuspendPropertyNotifications();
     }
     this.widthChangesSuspended = true;
     column.Width = (int)Math.Round((double)width / (double)column.DpiScale.Width);
     this.widthChangesSuspended = false;
     if (this.owner.IsResizeInProgress)
     {
         return;
     }
     column.ResumePropertyNotifications();
 }
        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));
        }