public static void MoveGroupDescription(ColumnCollection targetColumns, ObservableCollection <GroupDescription> targetGroupDescriptions, GroupLevelDescription targetGroupLevelDescription, DropMarkAlignment targetAlignment, GroupLevelDescription movedGroupLevelDescription, DataGridControl parentDataGridControl)
        {
            Debug.Assert(targetColumns != null);
            Debug.Assert(targetGroupDescriptions != null);
            Debug.Assert(targetGroupLevelDescription != null);
            Debug.Assert(movedGroupLevelDescription != null);

            if ((parentDataGridControl == null) ||
                (targetColumns == null) ||
                (targetGroupDescriptions == null) ||
                (targetGroupLevelDescription == null) ||
                (movedGroupLevelDescription == null))
            {
                return;
            }

            int oldPos = GroupingHelper.GetGroupDescriptionIndex(targetGroupDescriptions, movedGroupLevelDescription, DropMarkAlignment.Near);
            int newPos = GroupingHelper.GetGroupDescriptionIndex(targetGroupDescriptions, targetGroupLevelDescription, targetAlignment);

            if (newPos > oldPos)
            {
                newPos--;
            }

            if (newPos != oldPos)
            {
                Debug.Assert(oldPos < targetGroupDescriptions.Count);

                using (parentDataGridControl.SetQueueBringIntoViewRestrictions(AutoScrollCurrentItemSourceTriggers.CollectionViewCurrentItemChanged))
                {
                    targetGroupDescriptions.Move(oldPos, newPos);
                }
            }
        }
Exemple #2
0
        public static void MoveGroupDescription(ColumnCollection targetColumns, ObservableCollection <GroupDescription> targetGroupDescriptions, GroupLevelDescription targetGroupLevelDescription, DropMarkAlignment targetAlignment, GroupLevelDescription movedGroupLevelDescription, DataGridControl parentDataGridControl)
        {
            Debug.Assert(targetColumns != null);
            Debug.Assert(targetGroupDescriptions != null);
            Debug.Assert(targetGroupLevelDescription != null);
            Debug.Assert(movedGroupLevelDescription != null);

            if ((parentDataGridControl == null) ||
                (targetColumns == null) ||
                (targetGroupDescriptions == null) ||
                (targetGroupLevelDescription == null) ||
                (movedGroupLevelDescription == null))
            {
                return;
            }

            int oldPos = GroupingHelper.GetGroupDescriptionIndex(targetGroupDescriptions, movedGroupLevelDescription, DropMarkAlignment.Near);
            int newPos = GroupingHelper.GetGroupDescriptionIndex(targetGroupDescriptions, targetGroupLevelDescription, targetAlignment);

            if (newPos > oldPos)
            {
                newPos--;
            }

            if (newPos != oldPos)
            {
                Debug.Assert(oldPos < targetGroupDescriptions.Count);

                targetGroupDescriptions.Move(oldPos, newPos);
            }
        }