Exemple #1
0
        void IDropTarget.DragLeave(UIElement draggedElement)
        {
            ColumnManagerCell cell = draggedElement as ColumnManagerCell;

            if (cell == null)
            {
                return;
            }

            DataGridContext draggedDetailContext = DataGridControl.GetDataGridContext(draggedElement);

            int lastIndex = draggedDetailContext.GroupLevelDescriptions.Count - 1;

            if (lastIndex > -1)
            {
                GroupByItem groupByItem = this.ItemContainerGenerator.ContainerFromIndex(lastIndex) as GroupByItem;

                Debug.Assert(groupByItem != null);
                if (groupByItem == null)
                {
                    throw new DataGridInternalException("groupByItem is null.");
                }

                groupByItem.HideDropMark();
            }
            else
            {
                this.HideDropMark();
            }
        }
Exemple #2
0
        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)
            {
                GroupByItem groupByItem = ( GroupByItem )element;
                groupByItem.PrepareDefaultStyleKey(grid.GetView());
            }
        }
Exemple #3
0
        void IDropTarget.Drop(UIElement draggedElement)
        {
            if (m_dropMarkAdorner != null)
            {
                DataGridContext dataGridContext = DataGridControl.GetDataGridContext(this);

                Debug.Assert(dataGridContext != null);
                if (dataGridContext != null)
                {
                    GroupLevelDescription draggedOverGroupLevelDescription = this.Content as GroupLevelDescription;

                    Debug.Assert(draggedOverGroupLevelDescription != null);
                    if (draggedOverGroupLevelDescription != null)
                    {
                        DropMarkAlignment alignment = m_dropMarkAdorner.Alignment;

                        this.HideDropMark();

                        ColumnManagerCell draggedCell = draggedElement as ColumnManagerCell;

                        if (draggedCell != null)
                        {
                            GroupingHelper.AddNewGroupFromColumnManagerCell(draggedCell, draggedOverGroupLevelDescription, alignment, dataGridContext.DataGridControl);
                        }
                        else
                        {
                            GroupByItem draggedGroupBy = draggedElement as GroupByItem;

                            Debug.Assert(draggedGroupBy != null);

                            if (draggedGroupBy != null)
                            {
                                GroupLevelDescription draggedGroupLevelDescription = draggedGroupBy.Content as GroupLevelDescription;

                                GroupingHelper.MoveGroupDescription(dataGridContext.Columns, dataGridContext.Items.GroupDescriptions, draggedOverGroupLevelDescription, alignment, draggedGroupLevelDescription, dataGridContext.DataGridControl);
                            }
                        }
                    }
                }
            }
        }
Exemple #4
0
        private static void OnSortDirectionInternalChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            GroupByItem groupByItem = ( GroupByItem )sender;

            groupByItem.OnPropertyChanged(new PropertyChangedEventArgs("SortDirection"));
        }