コード例 #1
0
 private GridViewColumnGroup FindGroup(
     ColumnGroupCollection groups,
     GridViewColumn column)
 {
     foreach (GridViewColumnGroup group1 in (Collection <GridViewColumnGroup>)groups)
     {
         if (group1.Groups.Count > 0)
         {
             GridViewColumnGroup group2 = this.FindGroup(group1.Groups, column);
             if (group2 != null)
             {
                 return(group2);
             }
         }
         else
         {
             foreach (GridViewColumnGroupRow row in (Collection <GridViewColumnGroupRow>)group1.Rows)
             {
                 foreach (string columnName in (Collection <string>)row.ColumnNames)
                 {
                     if (columnName == column.Name)
                     {
                         return(group1);
                     }
                 }
             }
         }
     }
     return((GridViewColumnGroup)null);
 }
コード例 #2
0
        private void AddGroupColumn(GridViewColumnGroup group)
        {
            if (!group.IsVisible)
            {
                return;
            }
            GridViewGroupColumn gridViewGroupColumn = new GridViewGroupColumn(group);

            gridViewGroupColumn.OwnerTemplate = this.ViewTemplate;
            this.groupColumns.Add(group, gridViewGroupColumn);
            this.AddColumn(group, (GridViewColumn)gridViewGroupColumn);
            foreach (GridViewColumnGroup group1 in (Collection <GridViewColumnGroup>)group.Groups)
            {
                this.AddGroupColumn(group1);
            }
            if (group.Groups.Count != 0)
            {
                return;
            }
            foreach (GridViewColumnGroupRow row in (Collection <GridViewColumnGroupRow>)group.Rows)
            {
                foreach (string columnName in (Collection <string>)row.ColumnNames)
                {
                    if (this.ColumnIsVisible((GridViewColumn)this.ViewTemplate.Columns[columnName]) || this.IgnoreColumnVisibility)
                    {
                        this.AddColumn(group, (GridViewColumn)this.ViewTemplate.Columns[columnName]);
                    }
                }
            }
        }
コード例 #3
0
 public ColumnChooserItem(GridViewColumnGroup group, IRadServiceProvider serviceProvider)
 {
     this.group           = group;
     this.Text            = group.Text;
     this.serviceProvider = serviceProvider;
     this.WireEvents();
 }
コード例 #4
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));
        }
コード例 #5
0
 private bool HasVisibleColumn(GridViewColumnGroup group)
 {
     if (this.ShowEmptyGroups)
     {
         return(true);
     }
     if (group.Groups.Count > 0)
     {
         foreach (GridViewColumnGroup group1 in (Collection <GridViewColumnGroup>)group.Groups)
         {
             if (this.HasVisibleColumn(group1))
             {
                 return(true);
             }
         }
     }
     else
     {
         foreach (GridViewColumnGroupRow row in (Collection <GridViewColumnGroupRow>)group.Rows)
         {
             foreach (string columnName in (Collection <string>)row.ColumnNames)
             {
                 if (this.ColumnIsVisible((GridViewColumn)this.ViewTemplate.Columns[columnName]))
                 {
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
コード例 #6
0
        protected override bool ProcessDragOver(Point currentMouseLocation, ISupportDrag dragObject)
        {
            object dataContext = dragObject.GetDataContext();

            if (!this.ViewTemplate.AllowColumnReorder)
            {
                return(false);
            }
            if (dataContext is GridViewColumnGroup)
            {
                return(true);
            }
            if (dataContext is GridViewGroupColumn)
            {
                GridViewGroupColumn gridViewGroupColumn = (GridViewGroupColumn)dataContext;
                for (GridViewColumnGroup gridViewColumnGroup = this.GridViewGroupColumn.Group; gridViewColumnGroup != null; gridViewColumnGroup = gridViewColumnGroup.Parent)
                {
                    if (gridViewColumnGroup == gridViewGroupColumn.Group)
                    {
                        return(false);
                    }
                }
            }
            return(base.ProcessDragOver(currentMouseLocation, dragObject));
        }
コード例 #7
0
 public GridViewGroupColumn(GridViewColumnGroup group)
 {
     this.group                  = group;
     this.HeaderText             = group.Text;
     this.PinPosition            = this.group.PinPosition;
     this.AllowResize            = true;
     this.group.PropertyChanged += new PropertyChangedEventHandler(this.group_PropertyChanged);
 }
コード例 #8
0
 public GridViewTemplate FindTemplate()
 {
     for (GridViewColumnGroup gridViewColumnGroup = this; gridViewColumnGroup != null; gridViewColumnGroup = gridViewColumnGroup.Parent)
     {
         if (gridViewColumnGroup.ParentViewDefinition != null)
         {
             return(gridViewColumnGroup.ParentViewDefinition.ViewTemplate);
         }
     }
     return((GridViewTemplate)null);
 }
コード例 #9
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;
 }
コード例 #10
0
        private bool ShouldStretchColumn(ColumnGroupsCellArrangeInfo info)
        {
            GridViewColumnGroup group = info.Group;

            if (group == null)
            {
                return(false);
            }
            GridViewColumnGroup rootColumnGroup = group?.RootColumnGroup;

            return((rootColumnGroup == null || !rootColumnGroup.ShowHeader) && (info.Row == null && group.Parent == rootColumnGroup || group == rootColumnGroup && group.Rows.IndexOf(info.Row) == 0));
        }
コード例 #11
0
 private ColumnGroupCollection FindGroupCollection(
     ColumnGroupsViewDefinition view,
     GridViewColumnGroup group)
 {
     if (group.Parent != null)
     {
         return(group.Parent.Groups);
     }
     if (group.ParentViewDefinition == view)
     {
         return(view.ColumnGroups);
     }
     return((ColumnGroupCollection)null);
 }
コード例 #12
0
        private void DropColumnGroup(
            ColumnGroupsViewDefinition view,
            GridViewColumnGroup group,
            RadPosition dropPosition)
        {
            ColumnGroupCollection groupCollection1 = this.FindGroupCollection(view, this.GridViewGroupColumn.Group);
            ColumnGroupCollection groupCollection2 = this.FindGroupCollection(view, group);
            int index = groupCollection1.IndexOf(this.GridViewGroupColumn.Group);

            if (groupCollection1 == groupCollection2 && groupCollection2 != null && groupCollection2.IndexOf(group) < index)
            {
                --index;
            }
            if (group.Parent != null)
            {
                group.Parent.Groups.Remove(group);
            }
            else
            {
                view.ColumnGroups.Remove(group);
            }
            if ((dropPosition & RadPosition.Bottom) != RadPosition.None && this.GridViewGroupColumn.Group.Rows.Count == 0)
            {
                this.GridViewGroupColumn.Group.Groups.Add(group);
            }
            else if ((dropPosition & RadPosition.Left) != RadPosition.None)
            {
                groupCollection1.Insert(index, group);
            }
            else if (index < groupCollection1.Count - 1)
            {
                groupCollection1.Remove(group);
                groupCollection1.Insert(index + 1, group);
            }
            else
            {
                groupCollection1.Add(group);
            }
            if (!group.IsVisible)
            {
                group.IsVisible = true;
            }
            ColumnGroupRowLayout rowLayout = this.TableElement.ViewElement.RowLayout as ColumnGroupRowLayout;

            rowLayout.InvalidateLayout();
            rowLayout.InvalidateRenderColumns();
            this.TableElement.ViewElement.UpdateRows(true);
        }
コード例 #13
0
ファイル: GridRowElement.cs プロジェクト: RichardHaggard/BDC
 protected override bool ProcessDragOver(Point currentMouseLocation, ISupportDrag dragObject)
 {
     if (dragObject is ColumnChooserItem)
     {
         object             dataContext        = dragObject.GetDataContext();
         GridViewDataColumn gridViewDataColumn = dataContext as GridViewDataColumn;
         if (gridViewDataColumn != null)
         {
             return(!gridViewDataColumn.IsVisible);
         }
         GridViewColumnGroup gridViewColumnGroup = dataContext as GridViewColumnGroup;
         if (gridViewColumnGroup != null)
         {
             return(!gridViewColumnGroup.IsVisible);
         }
     }
     return(false);
 }
コード例 #14
0
 private void HideColumnsInGroup(GridViewColumnGroup group)
 {
     if (group.Rows.Count > 0)
     {
         foreach (GridViewColumnGroupRow row in (Collection <GridViewColumnGroupRow>)group.Rows)
         {
             foreach (string columnName in (Collection <string>)row.ColumnNames)
             {
                 this.ViewTemplate.Columns[columnName].IsVisible = false;
             }
         }
     }
     else
     {
         foreach (GridViewColumnGroup group1 in (Collection <GridViewColumnGroup>)group.Groups)
         {
             this.HideColumnsInGroup(group1);
         }
     }
 }
コード例 #15
0
 private void AddGroupsRecursively(ColumnGroupLayoutNode node, GridViewColumnGroup group)
 {
     foreach (GridViewColumnGroup group1 in (Collection <GridViewColumnGroup>)group.Groups)
     {
         if (group1.IsVisible)
         {
             ColumnGroupLayoutNode node1 = new ColumnGroupLayoutNode(group1);
             this.AddGroupsRecursively(node1, group1);
             node.Children.Add(node1);
             node1.Parent = node;
         }
     }
     if (group.Groups.Count > 0 || group.Rows.Count <= 0)
     {
         return;
     }
     node.Children.Add(new ColumnGroupLayoutNode(group.Rows)
     {
         Parent = node
     });
 }
コード例 #16
0
ファイル: GridRowElement.cs プロジェクト: RichardHaggard/BDC
        protected override void ProcessDragDrop(Point dropLocation, ISupportDrag dragObject)
        {
            if (!(dragObject is ColumnChooserItem) || this.ViewTemplate.ViewDefinition is ColumnGroupsViewDefinition)
            {
                return;
            }
            object             dataContext        = dragObject.GetDataContext();
            GridViewDataColumn gridViewDataColumn = dataContext as GridViewDataColumn;

            if (gridViewDataColumn != null)
            {
                gridViewDataColumn.IsVisible = true;
            }
            else
            {
                GridViewColumnGroup gridViewColumnGroup = dataContext as GridViewColumnGroup;
                if (gridViewColumnGroup == null)
                {
                    return;
                }
                gridViewColumnGroup.IsVisible = true;
            }
        }
コード例 #17
0
 private void AddColumn(GridViewColumnGroup group, GridViewColumn column)
 {
     if (!column.IsVisible && !this.IgnoreColumnVisibility || column is GridViewGroupColumn && !group.ShowHeader)
     {
         return;
     }
     if (group.PinPosition == PinnedColumnPosition.Left)
     {
         this.RenderColumns.Insert(this.lastPinnedLeftPosition, column);
         ++this.lastPinnedLeftPosition;
         ++this.lastScrollablePosition;
     }
     else if (group.PinPosition == PinnedColumnPosition.Right)
     {
         this.RenderColumns.Add(column);
     }
     else
     {
         this.RenderColumns.Insert(this.lastScrollablePosition, column);
         this.scrollableColumns.Add(column);
         ++this.lastScrollablePosition;
     }
 }
コード例 #18
0
 private IEnumerable <GridViewColumn> GetDataColumns(
     GridViewColumnGroup group)
 {
     if (group.Groups.Count > 0)
     {
         foreach (GridViewColumnGroup group1 in (Collection <GridViewColumnGroup>)group.Groups)
         {
             foreach (GridViewColumn dataColumn in this.GetDataColumns(group1))
             {
                 yield return(dataColumn);
             }
         }
     }
     else
     {
         foreach (GridViewColumnGroupRow row in (Collection <GridViewColumnGroupRow>)group.Rows)
         {
             foreach (string columnName in (Collection <string>)row.ColumnNames)
             {
                 yield return((GridViewColumn)this.tableElement.ViewTemplate.Columns[columnName]);
             }
         }
     }
 }
コード例 #19
0
        private void deleteItem_Click(object sender, EventArgs e)
        {
            GridViewColumnGroup group        = this.GridViewGroupColumn.Group;
            GridViewTemplate    viewTemplate = this.ViewTemplate;

            if (group == null)
            {
                return;
            }
            this.HideColumnsInGroup(group);
            if (group.Parent != null)
            {
                group.Parent.Groups.Remove(group);
            }
            else if (group.ParentViewDefinition != null)
            {
                group.ParentViewDefinition.ColumnGroups.Remove(group);
            }
            this.TableElement.ViewElement.RowLayout.InvalidateLayout();
            this.TableElement.ViewElement.RowLayout.InvalidateRenderColumns();
            this.TableElement.ViewElement.UpdateRows(true);
            this.TableElement.UpdateView();
            viewTemplate?.OnNotifyPropertyChanged("ViewDefinition");
        }
コード例 #20
0
 public ColumnGroupLayoutNode(GridViewColumnGroup group)
     : this()
 {
     this.Group = group;
 }
コード例 #21
0
 protected override void DisposeManagedResources()
 {
     this.group.PropertyChanged -= new PropertyChangedEventHandler(this.group_PropertyChanged);
     this.group = (GridViewColumnGroup)null;
     base.DisposeManagedResources();
 }