internal void ShowFarDropMark(Point mousePosition) { int itemsCount = this.Items.Count; if (itemsCount < 1) { if (m_dropMarkAdorner == null) { DataGridContext dataGridContext = DataGridControl.GetDataGridContext(this); DataGridControl grid = (dataGridContext != null) ? dataGridContext.DataGridControl : null; Pen pen = UIViewBase.GetDropMarkPen(this); if ((pen == null) && (grid != null)) { UIViewBase uiViewBase = grid.GetView() as UIViewBase; pen = uiViewBase.DefaultDropMarkPen; } DropMarkOrientation orientation = UIViewBase.GetDropMarkOrientation(this); if ((orientation == DropMarkOrientation.Default) && (grid != null)) { UIViewBase uiViewBase = grid.GetView() as UIViewBase; orientation = uiViewBase.DefaultDropMarkOrientation; } m_dropMarkAdorner = new DropMarkAdorner(this, pen, orientation); AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this); if (adornerLayer != null) { adornerLayer.Add(m_dropMarkAdorner); } } // We Only want the drop mark to be displayed at the end of the HierarchicalGroupByControlNode m_dropMarkAdorner.ForceAlignment(DropMarkAlignment.Far); } else { HierarchicalGroupByItem hierarchicalGroupByItem = this.ItemContainerGenerator.ContainerFromIndex(itemsCount - 1) as HierarchicalGroupByItem; Debug.Assert(hierarchicalGroupByItem != null); GroupLevelDescription groupLevelDescription = hierarchicalGroupByItem.Content as GroupLevelDescription; Debug.Assert(groupLevelDescription != null); // Show Far DropMark only if not already grouped if (this.Items.Contains(groupLevelDescription) == false) { hierarchicalGroupByItem.ShowFarDropMark(mousePosition); } } }
private void DragSourceManager_DragOutsideQueryCursor(object sender, QueryCursorEventArgs e) { HierarchicalGroupByControlNode hierarchicalGroupByControlNode = HierarchicalGroupByItem.GetParentHierarchicalGroupByControlNode(this); if ((hierarchicalGroupByControlNode == null) || (!hierarchicalGroupByControlNode.IsGroupingModificationAllowed)) { return; } DataGridContext dataGridContext = DataGridControl.GetDataGridContext(this); if ((dataGridContext != null) && (dataGridContext.DataGridControl != null)) { UIViewBase uiViewBase = dataGridContext.DataGridControl.GetView() as UIViewBase; e.Cursor = (uiViewBase != null) ? uiViewBase.RemovingGroupCursor : UIViewBase.DefaultGroupDraggedOutsideCursor; } else { e.Cursor = UIViewBase.DefaultGroupDraggedOutsideCursor; } }
internal HierarchicalGroupByItemToggleColumnSortCommand(HierarchicalGroupByItem target) : base() { if (target == null) { throw new ArgumentNullException("owner"); } m_target = new WeakReference(target); if (target.ParentDataGridContext != null) { m_dataGridContext = new WeakReference(target.ParentDataGridContext); } DataGridContext groupByItemDataGridContext = DataGridControl.GetDataGridContext(target); ToggleColumnSortCommand.ThrowIfNull(groupByItemDataGridContext, "groupByItemDataGridContext"); DataGridControl dataGridControl = groupByItemDataGridContext.DataGridControl; ToggleColumnSortCommand.ThrowIfNull(dataGridControl, "dataGridControl"); m_dataGridControl = new WeakReference(dataGridControl); }
void IDropTarget.DragLeave(UIElement draggedElement) { ColumnManagerCell cell = draggedElement as ColumnManagerCell; if (cell != null) { HierarchicalGroupByControlNode hierarchicalGroupByControlNode = this.GetHierarchicalGroupByControlNodeFromColumnManagerCell(cell); // It may not be visible if (hierarchicalGroupByControlNode != null) { hierarchicalGroupByControlNode.HideFarDropMark(); } } else { HierarchicalGroupByItem hierarchicalGroupByItem = draggedElement as HierarchicalGroupByItem; if (hierarchicalGroupByItem == null) { return; } HierarchicalGroupByControlNode hierarchicalGroupByControlNode = this.GetHierarchicalGroupByControlNodeFromHierarchicalGroupByItem(hierarchicalGroupByItem); Debug.Assert(hierarchicalGroupByControlNode != null, "CanDrop should have returned false"); if (hierarchicalGroupByControlNode == null) { throw new DataGridInternalException("A HierarchicalGroupByControlNode must exist for every level."); } hierarchicalGroupByControlNode.HideFarDropMark(); } }
internal void ShowFarDropMark(ColumnManagerCell cell, Point mousePosition) { Debug.Assert(cell != null); if (cell == null) { return; } DataGridContext cellDataGridContext = DataGridControl.GetDataGridContext(cell); Debug.Assert(cellDataGridContext != null); if (cellDataGridContext == null) { throw new DataGridInternalException("DataGridContext cannot be null on ColumnManagerCell."); } // We already have GroupLevelDescriptions for this level, we should show DropMark on the last HierarchicalGroupByItem if (cellDataGridContext.GroupLevelDescriptions.Count > 0) { Debug.Assert(cellDataGridContext.GroupLevelDescriptions == this.GroupLevelDescriptions); if (cellDataGridContext.GroupLevelDescriptions != this.GroupLevelDescriptions) { return; } int lastIndex = this.GroupLevelDescriptions.Count - 1; // If there if (lastIndex > -1) { HierarchicalGroupByItem hierarchicalGroupByItem = this.ItemContainerGenerator.ContainerFromItem(this.GroupLevelDescriptions[lastIndex]) as HierarchicalGroupByItem; Debug.Assert(hierarchicalGroupByItem != null); if (hierarchicalGroupByItem == null) { return; } hierarchicalGroupByItem.ShowFarDropMark(mousePosition); } else { this.ShowFarDropMark(mousePosition); } } else { this.ShowFarDropMark(mousePosition); } }
protected override void PrepareContainerForItemOverride(DependencyObject element, object item) { DataGridContext dataGridContext = DataGridControl.GetDataGridContext(this); DataGridControl grid = (dataGridContext != null) ? dataGridContext.DataGridControl : null; base.PrepareContainerForItemOverride(element, item); if (grid != null) { HierarchicalGroupByItem groupByItem = ( HierarchicalGroupByItem )element; groupByItem.PrepareDefaultStyleKey(grid.GetView()); } }
private void DragSourceManager_DroppedOutside(object sender, EventArgs e) { HierarchicalGroupByControlNode hierarchicalGroupByControlNode = HierarchicalGroupByItem.GetParentHierarchicalGroupByControlNode(this); if (hierarchicalGroupByControlNode == null) { throw new DataGridInternalException(); } bool allowGroupingModification = hierarchicalGroupByControlNode.IsGroupingModificationAllowed; if (!allowGroupingModification) { return; } ObservableCollection <GroupDescription> groupDescriptions = this.ParentGroupDescriptions; if (groupDescriptions != null) { // Get the HierarchicalGroupByControl before removing us from it HierarchicalGroupByControl parentGBC = GroupingHelper.GetHierarchicalGroupByControl(this); GroupLevelDescription groupLevelDescription = this.Content as GroupLevelDescription; DataGridContext dataGridContext = DataGridControl.GetDataGridContext(this); DataGridControl parentDataGridControl = (dataGridContext != null) ? dataGridContext.DataGridControl : null; GroupingHelper.RemoveGroupDescription(groupDescriptions, groupLevelDescription, parentDataGridControl); // Notify groups have changed for NoGroupContent parentGBC.UpdateHasGroups(); // Update the HasGroups property Debug.Assert(parentGBC != null); if (parentGBC == null) { throw new DataGridInternalException("The hierarchical group-by item must be rooted by a HierarchicalGroupByControl."); } } }
internal void HideFarDropMark() { int itemsCount = this.Items.Count; if (itemsCount > 0) { HierarchicalGroupByItem hierarchicalGroupByItem = null; if (itemsCount > 1) { // Hide the before last item's DropMark if any in case hierarchicalGroupByItem = this.ItemContainerGenerator.ContainerFromIndex(itemsCount - 2) as HierarchicalGroupByItem; Debug.Assert(hierarchicalGroupByItem != null); if (hierarchicalGroupByItem != null) { hierarchicalGroupByItem.HideDropMark(); } } // Hide last item's DropMark if any hierarchicalGroupByItem = this.ItemContainerGenerator.ContainerFromIndex(itemsCount - 1) as HierarchicalGroupByItem; Debug.Assert(hierarchicalGroupByItem != null); if (hierarchicalGroupByItem != null) { hierarchicalGroupByItem.HideDropMark(); } } if (m_dropMarkAdorner != null) { AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this); if (adornerLayer != null) { adornerLayer.Remove(m_dropMarkAdorner); } m_dropMarkAdorner = null; } }
internal HierarchicalGroupByControlNode GetHierarchicalGroupByControlNodeFromHierarchicalGroupByItem( HierarchicalGroupByItem hierarchicalGroupByItem ) { Debug.Assert( hierarchicalGroupByItem != null ); if( hierarchicalGroupByItem == null ) return null; TreeView treeView = this.GetTemplateChild( @"PART_HierarchicalGroupByControlTreeView" ) as TreeView; if( treeView == null ) return null; if( treeView.Items.Count == 0 ) throw new DataGridInternalException( "The HierarchicalGroupByControl should contain at least one grouping level." ); // The first item is always the top level HierarchicalGroupByControlNode TreeViewItem rootItem = treeView.ItemContainerGenerator.ContainerFromItem( treeView.Items[ 0 ] ) as TreeViewItem; if( rootItem == null ) throw new DataGridInternalException( "The root item is null." ); GroupLevelDescription detailGroupLevelDescription = hierarchicalGroupByItem.Content as GroupLevelDescription; Debug.Assert( detailGroupLevelDescription != null ); TreeViewItem dropMarkedTreeViewItem = null; DataGridContext rootDataGridContext = rootItem.Header as DataGridContext; Debug.Assert( rootDataGridContext != null ); if( rootDataGridContext.GroupLevelDescriptions.Contains( detailGroupLevelDescription ) ) { dropMarkedTreeViewItem = rootItem; } else { dropMarkedTreeViewItem = HierarchicalGroupByControl.GetTreeViewItemFromGroupLevelDescription( rootItem, detailGroupLevelDescription ); } // If null, it means the cell does not belong to this detail if( dropMarkedTreeViewItem == null ) return null; ContentPresenter treeViewItemHeader = dropMarkedTreeViewItem.Template.FindName( "PART_Header", dropMarkedTreeViewItem ) as ContentPresenter; Debug.Assert( treeViewItemHeader != null ); if( treeViewItemHeader == null ) throw new DataGridInternalException( "An error occurred while retrieving the PART_Header template part of an item containing a HierarchicalGroupByControlNode." ); HierarchicalGroupByControlNode hierarchicalGroupByControlNode = HierarchicalGroupByControl.GetHierarchicalGroupByControlNode( treeViewItemHeader ); return hierarchicalGroupByControlNode; }
void IDropTarget.Drop(UIElement draggedElement) { ColumnManagerCell draggedColumnManagerCell = draggedElement as ColumnManagerCell; if (m_dropMarkAdorner != null) { GroupLevelDescription draggedOverGroupLevelDescription = this.Content as GroupLevelDescription; DropMarkAlignment alignment = m_dropMarkAdorner.Alignment; this.HideDropMark(); if (draggedColumnManagerCell != null) { DataGridContext dataGridContext = DataGridControl.GetDataGridContext(this); DataGridControl parentGrid = (dataGridContext != null) ? dataGridContext.DataGridControl : null; GroupingHelper.AddNewGroupFromColumnManagerCell(draggedColumnManagerCell, draggedOverGroupLevelDescription, alignment, parentGrid); } else { HierarchicalGroupByItem draggedGroupByItem = draggedElement as HierarchicalGroupByItem; if (draggedGroupByItem == null) { return; } GroupLevelDescription draggedGroupLevelDescription = draggedGroupByItem.Content as GroupLevelDescription; DataGridContext dataGridContext = DataGridControl.GetDataGridContext(this); DataGridControl parentDataGridControl = (dataGridContext != null) ? dataGridContext.DataGridControl : null; GroupLevelDescription destinationGroupLevelDescription = this.Content as GroupLevelDescription; GroupingHelper.MoveGroupDescription(this.ParentColumns, this.ParentGroupDescriptions, destinationGroupLevelDescription, alignment, draggedGroupLevelDescription, parentDataGridControl); } } else { // We try to add a new Group which is not in the current GroupLevelDescriptions if (draggedColumnManagerCell == null) { return; } DataGridContext dataGridContext = DataGridControl.GetDataGridContext(this); DataGridControl parentGrid = (dataGridContext != null) ? dataGridContext.DataGridControl : null; GroupingHelper.AppendNewGroupFromColumnManagerCell(draggedColumnManagerCell, parentGrid); } HierarchicalGroupByControl parentGBC = GroupingHelper.GetHierarchicalGroupByControl(this); Debug.Assert(parentGBC != null); if (parentGBC == null) { throw new DataGridInternalException("A hierarchical group-by item must be rooted by a HierarchicalGroupByControl."); } // Notify groups have changed for NoGroupContent parentGBC.UpdateHasGroups(); }
internal HierarchicalGroupByControlNode GetHierarchicalGroupByControlNodeFromHierarchicalGroupByItem(HierarchicalGroupByItem hierarchicalGroupByItem) { Debug.Assert(hierarchicalGroupByItem != null); if (hierarchicalGroupByItem == null) { return(null); } TreeView treeView = this.GetTemplateChild(@"PART_HierarchicalGroupByControlTreeView") as TreeView; if (treeView == null) { return(null); } if (treeView.Items.Count == 0) { throw new DataGridInternalException("The HierarchicalGroupByControl should contain at least one grouping level."); } // The first item is always the top level HierarchicalGroupByControlNode TreeViewItem rootItem = treeView.ItemContainerGenerator.ContainerFromItem(treeView.Items[0]) as TreeViewItem; if (rootItem == null) { throw new DataGridInternalException("The root item is null."); } GroupLevelDescription detailGroupLevelDescription = hierarchicalGroupByItem.Content as GroupLevelDescription; Debug.Assert(detailGroupLevelDescription != null); TreeViewItem dropMarkedTreeViewItem = null; DataGridContext rootDataGridContext = rootItem.Header as DataGridContext; Debug.Assert(rootDataGridContext != null); if (rootDataGridContext.GroupLevelDescriptions.Contains(detailGroupLevelDescription)) { dropMarkedTreeViewItem = rootItem; } else { dropMarkedTreeViewItem = HierarchicalGroupByControl.GetTreeViewItemFromGroupLevelDescription(rootItem, detailGroupLevelDescription); } // If null, it means the cell does not belong to this detail if (dropMarkedTreeViewItem == null) { return(null); } ContentPresenter treeViewItemHeader = dropMarkedTreeViewItem.Template.FindName("PART_Header", dropMarkedTreeViewItem) as ContentPresenter; Debug.Assert(treeViewItemHeader != null); if (treeViewItemHeader == null) { throw new DataGridInternalException("An error occurred while retrieving the PART_Header template part of an item containing a HierarchicalGroupByControlNode."); } HierarchicalGroupByControlNode hierarchicalGroupByControlNode = HierarchicalGroupByControl.GetHierarchicalGroupByControlNode(treeViewItemHeader); return(hierarchicalGroupByControlNode); }
private static void OnSortDirectionInternalChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) { HierarchicalGroupByItem groupByItem = ( HierarchicalGroupByItem )sender; groupByItem.OnPropertyChanged(new PropertyChangedEventArgs("SortDirection")); }
bool IDropTarget.CanDropElement(UIElement draggedElement) { bool canDrop = this.AllowGroupingModification; ColumnManagerCell cell = null; HierarchicalGroupByItem hierarchicalGroupByItem = null; if (canDrop) { cell = draggedElement as ColumnManagerCell; if (cell != null) { ColumnBase parentColumn = cell.ParentColumn; if ((parentColumn == null) || (!parentColumn.AllowGroup)) { return(false); } // Check if already grouped using the cell's DataGridContext canDrop = !GroupingHelper.IsAlreadyGroupedBy(cell); if (canDrop) { DataGridContext thisDataGridContext = DataGridControl.GetDataGridContext(this); if (thisDataGridContext.Items != null) { canDrop = thisDataGridContext.Items.CanGroup; } if (canDrop) { canDrop = GroupingHelper.IsColumnManagerCellInDataGridContext(thisDataGridContext, cell); if (canDrop == true) { canDrop = GroupingHelper.ValidateMaxGroupDescriptions(DataGridControl.GetDataGridContext(draggedElement)); } } } } else { hierarchicalGroupByItem = draggedElement as HierarchicalGroupByItem; if (hierarchicalGroupByItem == null) { canDrop = false; } if (canDrop) { // Try to get the HierarchicalGroupByControlNode in which this HierarchicalGroupByItem can be added using the parent HierarchicalGroupByControl => null it can't HierarchicalGroupByControlNode draggedHierarchicalGroupByControlNode = this.GetHierarchicalGroupByControlNodeFromHierarchicalGroupByItem(hierarchicalGroupByItem); if (draggedHierarchicalGroupByControlNode == null) { canDrop = false; } } } } bool returnedValue = ((cell != null) || (hierarchicalGroupByItem != null)) && // ColumnManagerCell or HierarchicalGroupByItem (canDrop); return(returnedValue); }
bool IDropTarget.CanDropElement(UIElement draggedElement) { ColumnManagerCell cell = null; HierarchicalGroupByItem hierarchicalGroupByItem = null; bool canDrop = this.AllowGroupingModification; if (canDrop) { cell = draggedElement as ColumnManagerCell; if (cell != null) { ColumnBase parentColumn = cell.ParentColumn; if ((parentColumn == null) || (!parentColumn.AllowGroup)) { return(false); } // Check if already grouped using the cell's DataGridContext canDrop = !GroupingHelper.IsAlreadyGroupedBy(cell); if (canDrop) { // Get the HierarchicalGroupByControl for this HierarchicalGroupByControlNode HierarchicalGroupByControl parentGBC = GroupingHelper.GetHierarchicalGroupByControl(this); if (parentGBC == null) { throw new DataGridInternalException("The hierarchical group-by control node must be rooted by a HierarchicalGroupByControl."); } DataGridContext parentGBCDataGridContext = DataGridControl.GetDataGridContext(parentGBC); Debug.Assert(parentGBCDataGridContext != null); if (parentGBCDataGridContext.Items != null) { canDrop = parentGBCDataGridContext.Items.CanGroup; } if (canDrop) { canDrop = GroupingHelper.IsColumnManagerCellInDataGridContext(parentGBCDataGridContext, cell); if (canDrop == true) { canDrop = GroupingHelper.ValidateMaxGroupDescriptions(DataGridControl.GetDataGridContext(draggedElement)); } } } } else { hierarchicalGroupByItem = draggedElement as HierarchicalGroupByItem; if (hierarchicalGroupByItem == null) { canDrop = false; } if (canDrop) { HierarchicalGroupByControl parentGBC = GroupingHelper.GetHierarchicalGroupByControl(this); if (parentGBC == null) { throw new DataGridInternalException("The hierarchical group-by control node must be rooted by a HierarchicalGroupByControl."); } // Try to get the HierarchicalGroupByControlNode in which this HierarchicalGroupByItem can be added using the parent HierarchicalGroupByControl => null it can't HierarchicalGroupByControlNode draggedHierarchicalGroupByControlNode = parentGBC.GetHierarchicalGroupByControlNodeFromHierarchicalGroupByItem(hierarchicalGroupByItem); if (draggedHierarchicalGroupByControlNode == null) { canDrop = false; } } } } bool returnedValue = ((cell != null) || (hierarchicalGroupByItem != null)) &&// ColumnManagerCell or HierarchicalGroupByItem (canDrop); return(returnedValue); }
void IDropTarget.DragOver(UIElement draggedElement, Point mousePosition) { ColumnManagerCell cell = draggedElement as ColumnManagerCell; if (cell != null) { DataGridContext draggedCellDataGridContext = DataGridControl.GetDataGridContext(cell); HierarchicalGroupByControlNode draggedOverHierarchicalGroupByControlNode = HierarchicalGroupByItem.GetParentHierarchicalGroupByControlNode(this); if (draggedCellDataGridContext == null) { throw new DataGridInternalException("A ColumnManagerCell must have a DataGridContext."); } if (draggedOverHierarchicalGroupByControlNode == null) { throw new DataGridInternalException(); } if (draggedOverHierarchicalGroupByControlNode.GroupLevelDescriptions == draggedCellDataGridContext.GroupLevelDescriptions) { this.ShowDropMark(mousePosition); } else { // This ColumnManagerCell does not belong this parent HierarchicalGroupByControlNode, display the DropMark on the correct one HierarchicalGroupByControl parentGBC = GroupingHelper.GetHierarchicalGroupByControl(draggedOverHierarchicalGroupByControlNode); if (parentGBC == null) { throw new DataGridInternalException("The hierarchical group-by item must be rooted by a HierarchicalGroupByControl."); } HierarchicalGroupByControlNode hierarchicalGroupByControlNode = parentGBC.GetHierarchicalGroupByControlNodeFromColumnManagerCell(cell); Debug.Assert(hierarchicalGroupByControlNode != null, "CanDrop should have returned false"); if (hierarchicalGroupByControlNode == null) { throw new DataGridInternalException("A HierarchicalGroupByControlNode must exist for every level."); } hierarchicalGroupByControlNode.ShowFarDropMark(cell, mousePosition); } } else { HierarchicalGroupByItem hierarchicalGroupByItem = draggedElement as HierarchicalGroupByItem; if (hierarchicalGroupByItem == null) { return; } HierarchicalGroupByControlNode draggedHierarchicalGroupByControlNode = HierarchicalGroupByItem.GetParentHierarchicalGroupByControlNode(hierarchicalGroupByItem); HierarchicalGroupByControlNode draggedOverHierarchicalGroupByControlNode = HierarchicalGroupByItem.GetParentHierarchicalGroupByControlNode(this); if (draggedHierarchicalGroupByControlNode == null) { throw new DataGridInternalException(); } if (draggedOverHierarchicalGroupByControlNode == null) { throw new DataGridInternalException(); } if (draggedHierarchicalGroupByControlNode.GroupLevelDescriptions == draggedOverHierarchicalGroupByControlNode.GroupLevelDescriptions) { this.ShowDropMark(mousePosition); } else { // This HierarchicalGroupByItem does not belong this parent HierarchicalGroupByControlNode, display the DropMark on the correct one HierarchicalGroupByControl parentGBC = GroupingHelper.GetHierarchicalGroupByControl(draggedOverHierarchicalGroupByControlNode); if (parentGBC == null) { throw new DataGridInternalException("A hierarchical group-by item must be rooted by a HierarchicalGroupByControl."); } HierarchicalGroupByControlNode hierarchicalGroupByControlNode = parentGBC.GetHierarchicalGroupByControlNodeFromHierarchicalGroupByItem(hierarchicalGroupByItem); Debug.Assert(hierarchicalGroupByControlNode != null, "CanDrop should have returned false"); if (hierarchicalGroupByControlNode == null) { throw new DataGridInternalException("A HierarchicalGroupByControlNode must exist for every level."); } hierarchicalGroupByControlNode.ShowFarDropMark(mousePosition); } } }
void IDropTarget.DragLeave(UIElement draggedElement) { ColumnManagerCell cell = draggedElement as ColumnManagerCell; if (cell != null) { HierarchicalGroupByControl parentGBC = GroupingHelper.GetHierarchicalGroupByControl(this); if (parentGBC == null) { throw new DataGridInternalException("The hierarchical group-by control node must be rooted by a HierarchicalGroupByControl."); } HierarchicalGroupByControlNode hierarchicalGroupByControlNode = parentGBC.GetHierarchicalGroupByControlNodeFromColumnManagerCell(cell); if (hierarchicalGroupByControlNode == null) { throw new DataGridInternalException("A HierarchicalGroupByControlNode must exist for every level."); } hierarchicalGroupByControlNode.HideFarDropMark(cell); } else { HierarchicalGroupByItem hierarchicalGroupByItem = draggedElement as HierarchicalGroupByItem; if (hierarchicalGroupByItem == null) { return; } HierarchicalGroupByControlNode draggedHierarchicalGroupByControlNode = HierarchicalGroupByItem.GetParentHierarchicalGroupByControlNode(hierarchicalGroupByItem); if (draggedHierarchicalGroupByControlNode == null) { throw new DataGridInternalException("draggedHierarchicalGroupByControlNode is null."); } if (draggedHierarchicalGroupByControlNode.GroupLevelDescriptions == this.GroupLevelDescriptions) { this.HideFarDropMark(); } else { // This HierarchicalGroupByItem does not belong this parent HierarchicalGroupByControlNode, display the DropMark on the correct one HierarchicalGroupByControl parentGBC = GroupingHelper.GetHierarchicalGroupByControl(this); Debug.Assert(parentGBC != null); if (parentGBC == null) { throw new DataGridInternalException("The hierarchical group-by control node must be rooted by a HierarchicalGroupByControl"); } HierarchicalGroupByControlNode hierarchicalGroupByControlNode = parentGBC.GetHierarchicalGroupByControlNodeFromHierarchicalGroupByItem(hierarchicalGroupByItem); Debug.Assert(hierarchicalGroupByControlNode != null, "CanDrop should have returned false"); if (hierarchicalGroupByControlNode == null) { throw new DataGridInternalException("A HierarchicalGroupByControlNode must exist for every level."); } hierarchicalGroupByControlNode.HideFarDropMark(); } } }
internal HierarchicalGroupByItemToggleColumnSortCommand( HierarchicalGroupByItem target ) : base() { if( target == null ) throw new ArgumentNullException( "owner" ); m_target = new WeakReference( target ); if( target.ParentDataGridContext != null ) { m_dataGridContext = new WeakReference( target.ParentDataGridContext ); } DataGridContext groupByItemDataGridContext = DataGridControl.GetDataGridContext( target ); ToggleColumnSortCommand.ThrowIfNull( groupByItemDataGridContext, "groupByItemDataGridContext" ); DataGridControl dataGridControl = groupByItemDataGridContext.DataGridControl; ToggleColumnSortCommand.ThrowIfNull( dataGridControl, "dataGridControl" ); m_dataGridControl = new WeakReference( dataGridControl ); }