예제 #1
0
        public static bool ShouldNotifyRowSubtree(DataGridNotificationTarget target)
        {
            DataGridNotificationTarget value =
                DataGridNotificationTarget.Rows |
                DataGridNotificationTarget.RowHeaders |
                DataGridNotificationTarget.CellsPresenter |
                DataGridNotificationTarget.Cells |
                DataGridNotificationTarget.RefreshCellContent |
                DataGridNotificationTarget.DetailsPresenter;

            return(TestTarget(target, value));
        }
        /// <summary>
        ///     Notification for column header-related DependencyProperty changes from the grid or from columns.
        /// </summary>
        internal void NotifyPropertyChanged(DependencyObject d, string propertyName, DependencyPropertyChangedEventArgs e, DataGridNotificationTarget target)
        {
            DataGridColumn column = d as DataGridColumn;

            if (DataGridHelper.ShouldNotifyColumnHeadersPresenter(target))
            {
                if (e.Property == DataGridColumn.WidthProperty ||
                    e.Property == DataGridColumn.DisplayIndexProperty)
                {
                    if (column.IsVisible)
                    {
                        InvalidateDataGridCellsPanelMeasureAndArrange();
                    }
                }
                else if (e.Property == DataGrid.FrozenColumnCountProperty ||
                         e.Property == DataGridColumn.VisibilityProperty ||
                         e.Property == DataGrid.CellsPanelHorizontalOffsetProperty ||
                         string.Compare(propertyName, "ViewportWidth", StringComparison.Ordinal) == 0 ||
                         string.Compare(propertyName, "DelayedColumnWidthComputation", StringComparison.Ordinal) == 0)
                {
                    InvalidateDataGridCellsPanelMeasureAndArrange();
                }
                else if (e.Property == DataGrid.HorizontalScrollOffsetProperty)
                {
                    InvalidateArrange();
                    InvalidateDataGridCellsPanelMeasureAndArrange();
                }
                else if (string.Compare(propertyName, "RealizedColumnsBlockListForNonVirtualizedRows", StringComparison.Ordinal) == 0)
                {
                    InvalidateDataGridCellsPanelMeasureAndArrange(/* withColumnVirtualization */ false);
                }
                else if (string.Compare(propertyName, "RealizedColumnsBlockListForVirtualizedRows", StringComparison.Ordinal) == 0)
                {
                    InvalidateDataGridCellsPanelMeasureAndArrange(/* withColumnVirtualization */ true);
                }
                else if (e.Property == DataGrid.CellsPanelActualWidthProperty)
                {
                    InvalidateArrange();
                }
                else if (e.Property == DataGrid.EnableColumnVirtualizationProperty)
                {
                    DataGridHelper.TransferProperty(this, VirtualizingPanel.IsVirtualizingProperty);
                }
            }

            if (DataGridHelper.ShouldNotifyColumnHeaders(target))
            {
                if (e.Property == DataGridColumn.HeaderProperty)
                {
                    if (HeaderCollection != null)
                    {
                        HeaderCollection.NotifyHeaderPropertyChanged(column, e);
                    }
                }
                else
                {
                    // Notify the DataGridColumnHeader objects about property changes
                    ContainerTracking <DataGridColumnHeader> tracker = _headerTrackingRoot;

                    while (tracker != null)
                    {
                        tracker.Container.NotifyPropertyChanged(d, e);
                        tracker = tracker.Next;
                    }

                    // Handle Style & Height change notification for PART_FillerColumnHeader.
                    if (d is DataGrid &&
                        (e.Property == DataGrid.ColumnHeaderStyleProperty || e.Property == DataGrid.ColumnHeaderHeightProperty))
                    {
                        DataGridColumnHeader fillerColumnHeader = GetTemplateChild(ElementFillerColumnHeader) as DataGridColumnHeader;
                        if (fillerColumnHeader != null)
                        {
                            fillerColumnHeader.NotifyPropertyChanged(d, e);
                        }
                    }
                }
            }
        }
 /// <summary>
 ///     General notification for DependencyProperty changes from the grid.
 /// </summary>
 internal void NotifyPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e, DataGridNotificationTarget target)
 {
     NotifyPropertyChanged(d, string.Empty, e, target);
 }
예제 #4
0
 public static bool ShouldNotifyColumnHeadersPresenter(DataGridNotificationTarget target)
 {
     return(TestTarget(target, DataGridNotificationTarget.ColumnHeadersPresenter));
 }
예제 #5
0
 // Token: 0x060048C4 RID: 18628 RVA: 0x0014A6D8 File Offset: 0x001488D8
 public static bool ShouldNotifyCellsPresenter(DataGridNotificationTarget target)
 {
     return(DataGridHelper.TestTarget(target, DataGridNotificationTarget.CellsPresenter));
 }
예제 #6
0
 /// <summary>
 ///     General notification for DependencyProperty changes from the grid or from columns.
 /// </summary>
 internal void NotifyPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e, DataGridNotificationTarget target)
 {
     NotifyPropertyChanged(d, string.Empty, e, target);
 }
        // Token: 0x060046EA RID: 18154 RVA: 0x00141A5C File Offset: 0x0013FC5C
        internal void NotifyPropertyChanged(DependencyObject d, string propertyName, DependencyPropertyChangedEventArgs e, DataGridNotificationTarget target)
        {
            DataGridColumn dataGridColumn = d as DataGridColumn;

            if (dataGridColumn != null && dataGridColumn != this.Column)
            {
                return;
            }
            if (DataGridHelper.ShouldNotifyCells(target))
            {
                if (e.Property == DataGridColumn.WidthProperty)
                {
                    DataGridHelper.OnColumnWidthChanged(this, e);
                }
                else if (e.Property == DataGrid.CellStyleProperty || e.Property == DataGridColumn.CellStyleProperty || e.Property == FrameworkElement.StyleProperty)
                {
                    DataGridHelper.TransferProperty(this, FrameworkElement.StyleProperty);
                }
                else if (e.Property == DataGrid.IsReadOnlyProperty || e.Property == DataGridColumn.IsReadOnlyProperty || e.Property == DataGridCell.IsReadOnlyProperty)
                {
                    DataGridHelper.TransferProperty(this, DataGridCell.IsReadOnlyProperty);
                }
                else if (e.Property == DataGridColumn.DisplayIndexProperty)
                {
                    base.TabIndex = dataGridColumn.DisplayIndex;
                }
                else if (e.Property == UIElement.IsKeyboardFocusWithinProperty)
                {
                    base.UpdateVisualState();
                }
            }
            if (DataGridHelper.ShouldRefreshCellContent(target) && dataGridColumn != null && this.NeedsVisualTree)
            {
                if (!string.IsNullOrEmpty(propertyName))
                {
                    dataGridColumn.RefreshCellContent(this, propertyName);
                    return;
                }
                if (e.Property != null)
                {
                    dataGridColumn.RefreshCellContent(this, e.Property.Name);
                }
            }
        }
예제 #8
0
        /// <summary>
        ///     General notification for DependencyProperty changes from the grid or from columns.
        /// </summary>
        internal void NotifyPropertyChanged(DependencyObject d, string propertyName, DependencyPropertyChangedEventArgs e, DataGridNotificationTarget target)
        {
            DataGridColumn column = d as DataGridColumn;

            if ((column != null) && (column != Column))
            {
                // This notification does not apply to this cell
                return;
            }

            // All the notifications which are to be handled by the cell
            if (DataGridHelper.ShouldNotifyCells(target))
            {
                if (e.Property == DataGridColumn.WidthProperty)
                {
                    DataGridHelper.OnColumnWidthChanged(this, e);
                }
                else if (e.Property == DataGrid.CellStyleProperty || e.Property == DataGridColumn.CellStyleProperty || e.Property == StyleProperty)
                {
                    DataGridHelper.TransferProperty(this, StyleProperty);
                }
                else if (e.Property == DataGrid.IsReadOnlyProperty || e.Property == DataGridColumn.IsReadOnlyProperty || e.Property == IsReadOnlyProperty)
                {
                    DataGridHelper.TransferProperty(this, IsReadOnlyProperty);
                }
                else if (e.Property == DataGridColumn.DisplayIndexProperty)
                {
                    TabIndex = column.DisplayIndex;
                }
                else if (e.Property == DataGrid.IsKeyboardFocusWithinProperty)
                {
                    UpdateVisualState();
                }
            }

            // All the notifications which needs forward to columns
            if (DataGridHelper.ShouldRefreshCellContent(target))
            {
                if (column != null && NeedsVisualTree)
                {
                    if (!string.IsNullOrEmpty(propertyName))
                    {
                        column.RefreshCellContent(this, propertyName);
                    }
                    else if (e != null && e.Property != null)
                    {
                        column.RefreshCellContent(this, e.Property.Name);
                    }
                }
            }
        }
예제 #9
0
 public static bool ShouldRefreshCellContent(DataGridNotificationTarget target)
 {
     return(TestTarget(target, DataGridNotificationTarget.RefreshCellContent));
 }
예제 #10
0
 public static bool ShouldNotifyDetailsPresenter(DataGridNotificationTarget target)
 {
     return(TestTarget(target, DataGridNotificationTarget.DetailsPresenter));
 }
예제 #11
0
        /// <summary>
        ///     General notification for DependencyProperty changes from the grid or from columns.
        /// </summary>
        internal void NotifyPropertyChanged(DependencyObject d, string propertyName, DependencyPropertyChangedEventArgs e, DataGridNotificationTarget target)
        {
            DataGridColumn column = d as DataGridColumn;
            if ((column != null) && (column != Column))
            {
                // This notification does not apply to this cell
                return;
            }

            // All the notifications which are to be handled by the cell
            if (DataGridHelper.ShouldNotifyCells(target))
            {
                if (e.Property == DataGridColumn.WidthProperty)
                {
                    DataGridHelper.OnColumnWidthChanged(this, e);
                }
                else if (e.Property == DataGrid.CellStyleProperty || e.Property == DataGridColumn.CellStyleProperty || e.Property == StyleProperty)
                {
                    DataGridHelper.TransferProperty(this, StyleProperty);
                }
                else if (e.Property == DataGrid.IsReadOnlyProperty || e.Property == DataGridColumn.IsReadOnlyProperty || e.Property == IsReadOnlyProperty)
                {
                    DataGridHelper.TransferProperty(this, IsReadOnlyProperty);
                }
                else if (e.Property == DataGridColumn.DisplayIndexProperty)
                {
                    TabIndex = column.DisplayIndex;
                }
                else if (e.Property == DataGrid.IsKeyboardFocusWithinProperty)
                {
                    UpdateVisualState();
                }
            }

            // All the notifications which needs forward to columns
            if (DataGridHelper.ShouldRefreshCellContent(target))
            {
                if (column != null && NeedsVisualTree)
                {
                    if (!string.IsNullOrEmpty(propertyName))
                    {
                        column.RefreshCellContent(this, propertyName);
                    }
                    else if (e != null && e.Property != null)
                    {
                        column.RefreshCellContent(this, e.Property.Name);
                    }
                }
            }
        }
예제 #12
0
        /// <summary>
        ///     General notification for DependencyProperty changes from the grid or from columns.
        /// </summary>
        internal void NotifyPropertyChanged(DependencyObject d, string propertyName, DependencyPropertyChangedEventArgs e, DataGridNotificationTarget target)
        {
            if (DataGridHelper.ShouldNotifyCellsPresenter(target))
            {
                if (e.Property == DataGridColumn.WidthProperty ||
                    e.Property == DataGridColumn.DisplayIndexProperty)
                {
                    if (((DataGridColumn)d).IsVisible)
                    {
                        InvalidateDataGridCellsPanelMeasureAndArrangeImpl((e.Property == DataGridColumn.WidthProperty) /*invalidateMeasureUptoRowsPresenter*/);
                    }
                }
                else if (e.Property == DataGrid.FrozenColumnCountProperty ||
                         e.Property == DataGridColumn.VisibilityProperty ||
                         e.Property == DataGrid.CellsPanelHorizontalOffsetProperty ||
                         e.Property == DataGrid.HorizontalScrollOffsetProperty ||
                         string.Compare(propertyName, "ViewportWidth", StringComparison.Ordinal) == 0 ||
                         string.Compare(propertyName, "DelayedColumnWidthComputation", StringComparison.Ordinal) == 0)
                {
                    InvalidateDataGridCellsPanelMeasureAndArrange();
                }
                else if (string.Compare(propertyName, "RealizedColumnsBlockListForNonVirtualizedRows", StringComparison.Ordinal) == 0)
                {
                    InvalidateDataGridCellsPanelMeasureAndArrange(/* withColumnVirtualization */ false);
                }
                else if (string.Compare(propertyName, "RealizedColumnsBlockListForVirtualizedRows", StringComparison.Ordinal) == 0)
                {
                    InvalidateDataGridCellsPanelMeasureAndArrange(/* withColumnVirtualization */ true);
                }
                else if (e.Property == DataGrid.RowHeightProperty || e.Property == HeightProperty)
                {
                    DataGridHelper.TransferProperty(this, HeightProperty);
                }
                else if (e.Property == DataGrid.MinRowHeightProperty || e.Property == MinHeightProperty)
                {
                    DataGridHelper.TransferProperty(this, MinHeightProperty);
                }
                else if (e.Property == DataGrid.EnableColumnVirtualizationProperty)
                {
                    DataGridHelper.TransferProperty(this, VirtualizingPanel.IsVirtualizingProperty);
                }
            }

            if (DataGridHelper.ShouldNotifyCells(target) ||
                DataGridHelper.ShouldRefreshCellContent(target))
            {
                ContainerTracking <DataGridCell> tracker = _cellTrackingRoot;
                while (tracker != null)
                {
                    tracker.Container.NotifyPropertyChanged(d, propertyName, e, target);
                    tracker = tracker.Next;
                }
            }
        }
        // Token: 0x06005CFA RID: 23802 RVA: 0x001A2818 File Offset: 0x001A0A18
        internal void NotifyPropertyChanged(DependencyObject d, string propertyName, DependencyPropertyChangedEventArgs e, DataGridNotificationTarget target)
        {
            DataGridColumn dataGridColumn = d as DataGridColumn;

            if (DataGridHelper.ShouldNotifyColumnHeadersPresenter(target))
            {
                if (e.Property == DataGridColumn.WidthProperty || e.Property == DataGridColumn.DisplayIndexProperty)
                {
                    if (dataGridColumn.IsVisible)
                    {
                        this.InvalidateDataGridCellsPanelMeasureAndArrange();
                    }
                }
                else if (e.Property == DataGrid.FrozenColumnCountProperty || e.Property == DataGridColumn.VisibilityProperty || e.Property == DataGrid.CellsPanelHorizontalOffsetProperty || string.Compare(propertyName, "ViewportWidth", StringComparison.Ordinal) == 0 || string.Compare(propertyName, "DelayedColumnWidthComputation", StringComparison.Ordinal) == 0)
                {
                    this.InvalidateDataGridCellsPanelMeasureAndArrange();
                }
                else if (e.Property == DataGrid.HorizontalScrollOffsetProperty)
                {
                    base.InvalidateArrange();
                    this.InvalidateDataGridCellsPanelMeasureAndArrange();
                }
                else if (string.Compare(propertyName, "RealizedColumnsBlockListForNonVirtualizedRows", StringComparison.Ordinal) == 0)
                {
                    this.InvalidateDataGridCellsPanelMeasureAndArrange(false);
                }
                else if (string.Compare(propertyName, "RealizedColumnsBlockListForVirtualizedRows", StringComparison.Ordinal) == 0)
                {
                    this.InvalidateDataGridCellsPanelMeasureAndArrange(true);
                }
                else if (e.Property == DataGrid.CellsPanelActualWidthProperty)
                {
                    base.InvalidateArrange();
                }
                else if (e.Property == DataGrid.EnableColumnVirtualizationProperty)
                {
                    DataGridHelper.TransferProperty(this, VirtualizingPanel.IsVirtualizingProperty);
                }
            }
            if (DataGridHelper.ShouldNotifyColumnHeaders(target))
            {
                if (e.Property == DataGridColumn.HeaderProperty)
                {
                    if (this.HeaderCollection != null)
                    {
                        this.HeaderCollection.NotifyHeaderPropertyChanged(dataGridColumn, e);
                        return;
                    }
                }
                else
                {
                    for (ContainerTracking <DataGridColumnHeader> containerTracking = this._headerTrackingRoot; containerTracking != null; containerTracking = containerTracking.Next)
                    {
                        containerTracking.Container.NotifyPropertyChanged(d, e);
                    }
                    if (d is DataGrid && (e.Property == DataGrid.ColumnHeaderStyleProperty || e.Property == DataGrid.ColumnHeaderHeightProperty))
                    {
                        DataGridColumnHeader dataGridColumnHeader = base.GetTemplateChild("PART_FillerColumnHeader") as DataGridColumnHeader;
                        if (dataGridColumnHeader != null)
                        {
                            dataGridColumnHeader.NotifyPropertyChanged(d, e);
                        }
                    }
                }
            }
        }
예제 #14
0
 // Token: 0x060048C9 RID: 18633 RVA: 0x0014A707 File Offset: 0x00148907
 public static bool ShouldNotifyDataGrid(DataGridNotificationTarget target)
 {
     return(DataGridHelper.TestTarget(target, DataGridNotificationTarget.DataGrid));
 }
예제 #15
0
 // Token: 0x060048C8 RID: 18632 RVA: 0x0014A6FE File Offset: 0x001488FE
 public static bool ShouldNotifyColumnCollection(DataGridNotificationTarget target)
 {
     return(DataGridHelper.TestTarget(target, DataGridNotificationTarget.ColumnCollection));
 }
예제 #16
0
파일: DataGrid.cs 프로젝트: JianwenSun/cc
        /// <summary>
        ///     General notification for DependencyProperty changes from the grid or from columns.
        /// </summary>
        /// <remarks>
        ///     This can be called from a variety of sources, such as from column objects
        ///     or from this DataGrid itself when there is a need to notify the rows and/or
        ///     the cells in the DataGrid about a property change. Down-stream handlers
        ///     can check the source of the change using the "d" parameter.
        /// </remarks>
        internal void NotifyPropertyChanged(DependencyObject d, string propertyName, DependencyPropertyChangedEventArgs e, DataGridNotificationTarget target)
        {
            if (DataGridHelper.ShouldNotifyDataGrid(target))
            {
                if (e.Property == AlternatingRowBackgroundProperty)
                {
                    // If the alternate row background is set, the count may be coerced to 2
                    CoerceValue(AlternationCountProperty);
                }
                else if ((e.Property == DataGridColumn.VisibilityProperty) || (e.Property == DataGridColumn.WidthProperty) || (e.Property == DataGridColumn.DisplayIndexProperty))
                {
                    // DataGridCellsPanel needs to be re-measured when column visibility changes
                    // Recyclable containers may not be fully remeasured when they are brought in
                    foreach (DependencyObject container in ItemContainerGenerator.RecyclableContainers)
                    {
                        DataGridRow row = container as DataGridRow;
                        if (row != null)
                        {
                            var cellsPresenter = row.CellsPresenter;
                            if (cellsPresenter != null)
                            {
                                cellsPresenter.InvalidateDataGridCellsPanelMeasureAndArrange();
                            }
                        }
                    }
                }
            }

            // Rows, Cells, CellsPresenter, DetailsPresenter or RowHeaders
            if (DataGridHelper.ShouldNotifyRowSubtree(target))
            {
                // Notify the Rows about the property change
                ContainerTracking<DataGridRow> tracker = _rowTrackingRoot;
                while (tracker != null)
                {
                    tracker.Container.NotifyPropertyChanged(d, propertyName, e, target);
                    tracker = tracker.Next;
                }
            }

            if (DataGridHelper.ShouldNotifyColumnCollection(target) || DataGridHelper.ShouldNotifyColumns(target))
            {
                InternalColumns.NotifyPropertyChanged(d, propertyName, e, target);
            }

            if ((DataGridHelper.ShouldNotifyColumnHeadersPresenter(target) || DataGridHelper.ShouldNotifyColumnHeaders(target)) && ColumnHeadersPresenter != null)
            {
                ColumnHeadersPresenter.NotifyPropertyChanged(d, propertyName, e, target);
            }
        }
예제 #17
0
        /// <summary>
        ///     General notification for DependencyProperty changes from the grid or from columns.
        /// </summary> 
        internal void NotifyPropertyChanged(DependencyObject d, string propertyName, DependencyPropertyChangedEventArgs e, DataGridNotificationTarget target)
        { 
            if (DataGridHelper.ShouldNotifyCellsPresenter(target)) 
            {
                if (e.Property == DataGridColumn.WidthProperty || 
                    e.Property == DataGridColumn.DisplayIndexProperty)
                {
                    if (((DataGridColumn)d).IsVisible)
                    { 
                        InvalidateDataGridCellsPanelMeasureAndArrange();
                    } 
                } 
                else if (e.Property == DataGrid.FrozenColumnCountProperty ||
                    e.Property == DataGridColumn.VisibilityProperty || 
                    e.Property == DataGrid.CellsPanelHorizontalOffsetProperty ||
                    e.Property == DataGrid.HorizontalScrollOffsetProperty ||
                    string.Compare(propertyName, "ViewportWidth", StringComparison.Ordinal) == 0 ||
                    string.Compare(propertyName, "DelayedColumnWidthComputation", StringComparison.Ordinal) == 0) 
                {
                    InvalidateDataGridCellsPanelMeasureAndArrange(); 
                } 
                else if (string.Compare(propertyName, "RealizedColumnsBlockListForNonVirtualizedRows", StringComparison.Ordinal) == 0)
                { 
                    InvalidateDataGridCellsPanelMeasureAndArrange(/* withColumnVirtualization */ false);
                }
                else if (string.Compare(propertyName, "RealizedColumnsBlockListForVirtualizedRows", StringComparison.Ordinal) == 0)
                { 
                    InvalidateDataGridCellsPanelMeasureAndArrange(/* withColumnVirtualization */ true);
                } 
                else if (e.Property == DataGrid.RowHeightProperty || e.Property == HeightProperty) 
                {
                    DataGridHelper.TransferProperty(this, HeightProperty); 
                }
                else if (e.Property == DataGrid.MinRowHeightProperty || e.Property == MinHeightProperty)
                {
                    DataGridHelper.TransferProperty(this, MinHeightProperty); 
                }
                else if (e.Property == DataGrid.EnableColumnVirtualizationProperty) 
                { 
                    DataGridHelper.TransferProperty(this, VirtualizingStackPanel.IsVirtualizingProperty);
                } 
            }

            if (DataGridHelper.ShouldNotifyCells(target) ||
                DataGridHelper.ShouldRefreshCellContent(target)) 
            {
                ContainerTracking<DataGridCell> tracker = _cellTrackingRoot; 
                while (tracker != null) 
                {
                    tracker.Container.NotifyPropertyChanged(d, propertyName, e, target); 
                    tracker = tracker.Next;
                }
            }
        } 
예제 #18
0
 public static bool ShouldNotifyRows(DataGridNotificationTarget target)
 {
     return(TestTarget(target, DataGridNotificationTarget.Rows));
 }
        /// <summary>
        ///     Notification for column header-related DependencyProperty changes from the grid or from columns. 
        /// </summary>
        internal void NotifyPropertyChanged(DependencyObject d, string propertyName, DependencyPropertyChangedEventArgs e, DataGridNotificationTarget target)
        {
            DataGridColumn column = d as DataGridColumn; 
            if (DataGridHelper.ShouldNotifyColumnHeadersPresenter(target))
            { 
                if (e.Property == DataGridColumn.WidthProperty || 
                    e.Property == DataGridColumn.DisplayIndexProperty)
                { 
                    if (column.IsVisible)
                    {
                        InvalidateDataGridCellsPanelMeasureAndArrange();
                    } 
                }
                else if (e.Property == DataGrid.FrozenColumnCountProperty || 
                    e.Property == DataGridColumn.VisibilityProperty || 
                    e.Property == DataGrid.CellsPanelHorizontalOffsetProperty ||
                    string.Compare(propertyName, "ViewportWidth", StringComparison.Ordinal) == 0 || 
                    string.Compare(propertyName, "DelayedColumnWidthComputation", StringComparison.Ordinal) == 0)
                {
                    InvalidateDataGridCellsPanelMeasureAndArrange();
                } 
                else if (e.Property == DataGrid.HorizontalScrollOffsetProperty)
                { 
                    InvalidateArrange(); 
                    InvalidateDataGridCellsPanelMeasureAndArrange();
                } 
                else if (string.Compare(propertyName, "RealizedColumnsBlockListForNonVirtualizedRows", StringComparison.Ordinal) == 0)
                {
                    InvalidateDataGridCellsPanelMeasureAndArrange(/* withColumnVirtualization */ false);
                } 
                else if (string.Compare(propertyName, "RealizedColumnsBlockListForVirtualizedRows", StringComparison.Ordinal) == 0)
                { 
                    InvalidateDataGridCellsPanelMeasureAndArrange(/* withColumnVirtualization */ true); 
                }
                else if (e.Property == DataGrid.CellsPanelActualWidthProperty) 
                {
                    InvalidateArrange();
                }
                else if (e.Property == DataGrid.EnableColumnVirtualizationProperty) 
                {
                    DataGridHelper.TransferProperty(this, VirtualizingStackPanel.IsVirtualizingProperty); 
                } 
            }
 
            if (DataGridHelper.ShouldNotifyColumnHeaders(target))
            {
                if (e.Property == DataGridColumn.HeaderProperty)
                { 
                    if (HeaderCollection != null)
                    { 
                        HeaderCollection.NotifyHeaderPropertyChanged(column, e); 
                    }
                } 
                else
                {
                    // Notify the DataGridColumnHeader objects about property changes
                    ContainerTracking<DataGridColumnHeader> tracker = _headerTrackingRoot; 

                    while (tracker != null) 
                    { 
                        tracker.Container.NotifyPropertyChanged(d, e);
                        tracker = tracker.Next; 
                    }

                    // Handle Style & Height change notification for PART_FillerColumnHeader.
                    if (d is DataGrid && 
                        (e.Property == DataGrid.ColumnHeaderStyleProperty || e.Property == DataGrid.ColumnHeaderHeightProperty) )
                    { 
                        DataGridColumnHeader fillerColumnHeader = GetTemplateChild(ElementFillerColumnHeader) as DataGridColumnHeader; 
                        if (fillerColumnHeader != null)
                        { 
                            fillerColumnHeader.NotifyPropertyChanged(d, e);
                        }
                    }
                } 
            }
        } 
예제 #20
0
 private static bool TestTarget(DataGridNotificationTarget target, DataGridNotificationTarget value)
 {
     return((target & value) != 0);
 }
예제 #21
0
        /// <summary>
        ///   General notification for DependencyProperty changes from the grid and/or column.
        /// </summary>
        internal void NotifyPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e, DataGridNotificationTarget target)
        {
            if (DataGridHelper.ShouldNotifyColumns(target))
            {
                // Remove columns target since we're handling it.  If we're targeting multiple targets it may also need to get
                // sent to the DataGrid.
                target &= ~DataGridNotificationTarget.Columns;

                if (e.Property == DataGrid.MaxColumnWidthProperty || e.Property == MaxWidthProperty)
                {
                    DataGridHelper.TransferProperty(this, MaxWidthProperty);
                }
                else if (e.Property == DataGrid.MinColumnWidthProperty || e.Property == MinWidthProperty)
                {
                    DataGridHelper.TransferProperty(this, MinWidthProperty);
                }
                else if (e.Property == DataGrid.ColumnWidthProperty || e.Property == WidthProperty)
                {
                    DataGridHelper.TransferProperty(this, WidthProperty);
                }
                else if (e.Property == DataGrid.ColumnHeaderStyleProperty || e.Property == HeaderStyleProperty)
                {
                    DataGridHelper.TransferProperty(this, HeaderStyleProperty);
                }
                else if (e.Property == DataGrid.CellStyleProperty || e.Property == CellStyleProperty)
                {
                    DataGridHelper.TransferProperty(this, CellStyleProperty);
                }
                else if (e.Property == DataGrid.IsReadOnlyProperty || e.Property == IsReadOnlyProperty)
                {
                    DataGridHelper.TransferProperty(this, IsReadOnlyProperty);
                }
                else if (e.Property == DataGrid.DragIndicatorStyleProperty || e.Property == DragIndicatorStyleProperty)
                {
                    DataGridHelper.TransferProperty(this, DragIndicatorStyleProperty);
                }
                else if (e.Property == DisplayIndexProperty)
                {
                    CoerceValue(IsFrozenProperty);
                }
                else if (e.Property == DataGrid.CanUserSortColumnsProperty)
                {
                    DataGridHelper.TransferProperty(this, CanUserSortProperty);
                }
                else if (e.Property == DataGrid.CanUserResizeColumnsProperty || e.Property == CanUserResizeProperty)
                {
                    DataGridHelper.TransferProperty(this, CanUserResizeProperty);
                }
                else if (e.Property == DataGrid.CanUserReorderColumnsProperty || e.Property == CanUserReorderProperty)
                {
                    DataGridHelper.TransferProperty(this, CanUserReorderProperty);
                }

                if (e.Property == WidthProperty || e.Property == MinWidthProperty || e.Property == MaxWidthProperty)
                {
                    CoerceValue(ActualWidthProperty);
                }
            }

            if (target != DataGridNotificationTarget.None)
            {
                // Everything else gets sent to the DataGrid so it can propogate back down
                // to the targets that need notification.
                DataGridColumn column = (DataGridColumn)d;
                DataGrid dataGridOwner = column.DataGridOwner;
                if (dataGridOwner != null)
                {
                    dataGridOwner.NotifyPropertyChanged(d, e, target);
                }
            }
        }
예제 #22
0
 public static bool ShouldNotifyColumns(DataGridNotificationTarget target)
 {
     return(TestTarget(target, DataGridNotificationTarget.Columns));
 }
예제 #23
0
        /// <summary>
        ///     General notification for DependencyProperty changes from the grid or from columns.
        /// </summary>
        internal void NotifyPropertyChanged(DependencyObject d, string propertyName, DependencyPropertyChangedEventArgs e, DataGridNotificationTarget target)
        {
            if (DataGridHelper.ShouldNotifyRows(target))
            {
                if (e.Property == DataGrid.RowBackgroundProperty || e.Property == DataGrid.AlternatingRowBackgroundProperty ||
                    e.Property == BackgroundProperty || e.Property == AlternationIndexProperty)
                {
                    DataGridHelper.TransferProperty(this, BackgroundProperty);
                }
                else if (e.Property == DataGrid.RowHeaderStyleProperty || e.Property == HeaderStyleProperty)
                {
                    DataGridHelper.TransferProperty(this, HeaderStyleProperty);
                }
                else if (e.Property == DataGrid.RowHeaderTemplateProperty || e.Property == HeaderTemplateProperty)
                {
                    DataGridHelper.TransferProperty(this, HeaderTemplateProperty);
                }
                else if (e.Property == DataGrid.RowHeaderTemplateSelectorProperty || e.Property == HeaderTemplateSelectorProperty)
                {
                    DataGridHelper.TransferProperty(this, HeaderTemplateSelectorProperty);
                }
                else if (e.Property == DataGrid.RowValidationErrorTemplateProperty || e.Property == ValidationErrorTemplateProperty)
                {
                    DataGridHelper.TransferProperty(this, ValidationErrorTemplateProperty);
                }
                else if (e.Property == DataGrid.RowDetailsTemplateProperty || e.Property == DetailsTemplateProperty)
                {
                    DataGridHelper.TransferProperty(this, DetailsTemplateProperty);
                    DataGridHelper.TransferProperty(this, DetailsVisibilityProperty);
                }
                else if (e.Property == DataGrid.RowDetailsTemplateSelectorProperty || e.Property == DetailsTemplateSelectorProperty)
                {
                    DataGridHelper.TransferProperty(this, DetailsTemplateSelectorProperty);
                    DataGridHelper.TransferProperty(this, DetailsVisibilityProperty);
                }
                else if (e.Property == DataGrid.RowDetailsVisibilityModeProperty || e.Property == DetailsVisibilityProperty || e.Property == IsSelectedProperty)
                {
                    DataGridHelper.TransferProperty(this, DetailsVisibilityProperty);
                }
                else if (e.Property == ItemProperty)
                {
                    OnItemChanged(e.OldValue, e.NewValue);
                }
                else if (e.Property == HeaderProperty)
                {
                    OnHeaderChanged(e.OldValue, e.NewValue);
                }
                else if (e.Property == BindingGroupProperty)
                {
                    // Re-run validation, but wait until Binding has occured.
                    Dispatcher.BeginInvoke(new DispatcherOperationCallback(DelayedValidateWithoutUpdate), DispatcherPriority.DataBind, e.NewValue);
                }
                else if (e.Property == DataGridRow.IsEditingProperty ||
                         e.Property == DataGridRow.IsMouseOverProperty ||
                         e.Property == DataGrid.IsKeyboardFocusWithinProperty)
                {
                    UpdateVisualState();
                }
            }

            if (DataGridHelper.ShouldNotifyDetailsPresenter(target))
            {
                if (DetailsPresenter != null)
                {
                    DetailsPresenter.NotifyPropertyChanged(d, e);
                }
            }

            if (DataGridHelper.ShouldNotifyCellsPresenter(target) ||
                DataGridHelper.ShouldNotifyCells(target) ||
                DataGridHelper.ShouldRefreshCellContent(target))
            {
                DataGridCellsPresenter cellsPresenter = CellsPresenter;
                if (cellsPresenter != null)
                {
                    cellsPresenter.NotifyPropertyChanged(d, propertyName, e, target);
                }
            }

            if (DataGridHelper.ShouldNotifyRowHeaders(target) && RowHeader != null)
            {
                RowHeader.NotifyPropertyChanged(d, e);
            }
        }
예제 #24
0
 // Token: 0x060048CC RID: 18636 RVA: 0x0014A72B File Offset: 0x0014892B
 public static bool ShouldNotifyRowHeaders(DataGridNotificationTarget target)
 {
     return(DataGridHelper.TestTarget(target, DataGridNotificationTarget.RowHeaders));
 }