Esempio n. 1
0
        /// <summary>Prepares the cell to display the specified item.</summary>
        /// <param name="element">The cell to prepare.</param>
        /// <param name="item">The item to display.</param>
        // Token: 0x06005C9A RID: 23706 RVA: 0x001A0D68 File Offset: 0x0019EF68
        protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
        {
            DataGridCell dataGridCell     = (DataGridCell)element;
            DataGridRow  dataGridRowOwner = this.DataGridRowOwner;

            if (dataGridCell.RowOwner != dataGridRowOwner)
            {
                dataGridCell.Tracker.StartTracking(ref this._cellTrackingRoot);
            }
            dataGridCell.PrepareCell(item, this, dataGridRowOwner);
        }
        /// <summary>
        ///     Prepares a new container for a given item.
        /// </summary>
        /// <param name="element">The new container.</param>
        /// <param name="item">The item that the container represents.</param>
        protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
        {
            DataGridCell cell     = (DataGridCell)element;
            DataGridRow  rowOwner = DataGridRowOwner;

            if (cell.RowOwner != rowOwner)
            {
                cell.Tracker.StartTracking(ref _cellTrackingRoot);
            }

            cell.PrepareCell(item, this, rowOwner);
        }
Esempio n. 3
0
        // Token: 0x06005C91 RID: 23697 RVA: 0x001A0AF0 File Offset: 0x0019ECF0
        internal void SyncProperties(bool forcePrepareCells)
        {
            DataGrid dataGridOwner = this.DataGridOwner;

            if (dataGridOwner == null)
            {
                return;
            }
            DataGridHelper.TransferProperty(this, FrameworkElement.HeightProperty);
            DataGridHelper.TransferProperty(this, FrameworkElement.MinHeightProperty);
            DataGridHelper.TransferProperty(this, VirtualizingPanel.IsVirtualizingProperty);
            this.NotifyPropertyChanged(this, new DependencyPropertyChangedEventArgs(DataGrid.CellStyleProperty, null, null), DataGridNotificationTarget.Cells);
            MultipleCopiesCollection multipleCopiesCollection = base.ItemsSource as MultipleCopiesCollection;

            if (multipleCopiesCollection != null)
            {
                ObservableCollection <DataGridColumn> columns = dataGridOwner.Columns;
                int  count  = columns.Count;
                int  count2 = multipleCopiesCollection.Count;
                int  num    = 0;
                bool flag   = false;
                if (count != count2)
                {
                    multipleCopiesCollection.SyncToCount(count);
                    num = Math.Min(count, count2);
                }
                else if (forcePrepareCells)
                {
                    num = count;
                }
                DataGridCellsPanel dataGridCellsPanel = this.InternalItemsHost as DataGridCellsPanel;
                if (dataGridCellsPanel != null)
                {
                    if (dataGridCellsPanel.HasCorrectRealizedColumns)
                    {
                        dataGridCellsPanel.InvalidateArrange();
                    }
                    else
                    {
                        this.InvalidateDataGridCellsPanelMeasureAndArrange();
                        flag = true;
                    }
                }
                DataGridRow dataGridRowOwner = this.DataGridRowOwner;
                for (int i = 0; i < num; i++)
                {
                    DataGridCell dataGridCell = (DataGridCell)base.ItemContainerGenerator.ContainerFromIndex(i);
                    if (dataGridCell != null)
                    {
                        dataGridCell.PrepareCell(dataGridRowOwner.Item, this, dataGridRowOwner);
                        if (!flag && !DoubleUtil.AreClose(dataGridCell.ActualWidth, columns[i].Width.DisplayValue))
                        {
                            this.InvalidateDataGridCellsPanelMeasureAndArrange();
                            flag = true;
                        }
                    }
                }
                if (!flag)
                {
                    for (int j = num; j < count; j++)
                    {
                        DataGridCell dataGridCell = (DataGridCell)base.ItemContainerGenerator.ContainerFromIndex(j);
                        if (dataGridCell != null && !DoubleUtil.AreClose(dataGridCell.ActualWidth, columns[j].Width.DisplayValue))
                        {
                            this.InvalidateDataGridCellsPanelMeasureAndArrange();
                            return;
                        }
                    }
                }
            }
        }