コード例 #1
0
        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;
            }
        }
コード例 #2
0
        internal void HideFarDropMark(ColumnManagerCell cell)
        {
            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.");
            }

            this.HideFarDropMark();

            // 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 (lastIndex > -1)
                {
                    HierarchicalGroupByItem hierarchicalGroupByItem = this.ItemContainerGenerator.ContainerFromItem(this.GroupLevelDescriptions[lastIndex]) as HierarchicalGroupByItem;

                    Debug.Assert(hierarchicalGroupByItem != null);
                    if (hierarchicalGroupByItem == null)
                    {
                        return;
                    }

                    hierarchicalGroupByItem.HideDropMark();
                }
            }
        }