Esempio n. 1
0
        bool IDropTarget.CanDropElement(UIElement draggedElement)
        {
            bool             allowColumnReorder = true;
            ColumnManagerRow parentRow          = this.ParentRow as ColumnManagerRow;

            if (parentRow != null)
            {
                allowColumnReorder = parentRow.AllowColumnReorder;
            }

            DataGridContext sourceDetailContext = this.DataGridContext;

            Debug.Assert(sourceDetailContext != null);
            DetailConfiguration sourceDetailConfig = (sourceDetailContext != null) ? sourceDetailContext.SourceDetailConfiguration : null;

            DataGridContext draggedDetailContext = DataGridControl.GetDataGridContext(draggedElement);

            Debug.Assert(draggedDetailContext != null);
            DetailConfiguration draggedDetailConfig = (draggedDetailContext != null) ? draggedDetailContext.SourceDetailConfiguration : null;


            return((sourceDetailConfig == draggedDetailConfig) &&
                   (sourceDetailContext != null) &&
                   (draggedDetailContext != null) &&
                   (sourceDetailContext.GroupLevelDescriptions == draggedDetailContext.GroupLevelDescriptions) &&
                   (allowColumnReorder) &&
                   (draggedElement is ColumnManagerCell) &&
                   (draggedElement != this));
        }
        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));
        }
        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);
        }
Esempio n. 4
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);
            }

            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);
        }