Example #1
0
        bool IDropTarget.CanDropElement(UIElement draggedElement)
        {
            ColumnManagerCell draggedCell = draggedElement as ColumnManagerCell;

            if ((draggedCell == null) || (this == draggedCell))
            {
                return(false);
            }

            ColumnManagerRow parentRow = this.ParentRow as ColumnManagerRow;

            if ((parentRow == null) || !parentRow.AllowColumnReorder)
            {
                return(false);
            }

            if (!ColumnManagerCell.CanMove(draggedCell) || !ColumnManagerCell.CanMove(this))
            {
                return(false);
            }

            DataGridContext draggedDetailContext = draggedCell.DataGridContext;
            DataGridContext sourceDetailContext  = this.DataGridContext;

            Debug.Assert((draggedDetailContext != null) && (sourceDetailContext != null));

            return((sourceDetailContext.SourceDetailConfiguration == draggedDetailContext.SourceDetailConfiguration) &&
                   (sourceDetailContext.GroupLevelDescriptions == draggedDetailContext.GroupLevelDescriptions));
        }
Example #2
0
        internal bool CanDoSort()
        {
            ColumnManagerRow parentRow = this.ParentRow as ColumnManagerRow;

            if (parentRow != null)
            {
                if (!parentRow.AllowSort)
                {
                    return(false);
                }
            }

            DataGridContext dataGridContext = this.DataGridContext;

            if (dataGridContext == null)
            {
                return(false);
            }

            // When details are flatten, only the ColumnManagerCell at the master level may do the sort.
            if (dataGridContext.IsAFlattenDetail)
            {
                return(false);
            }

            if (dataGridContext.SourceDetailConfiguration == null)
            {
                if (!dataGridContext.Items.CanSort)
                {
                    return(false);
                }
            }

            if (!this.IsEnabled)
            {
                return(false);
            }

            ColumnBase parentColumn = this.ParentColumn;

            if ((parentColumn == null) || (!parentColumn.AllowSort))
            {
                return(false);
            }

            return(true);
        }