示例#1
0
        // Token: 0x06005D1F RID: 23839 RVA: 0x001A3574 File Offset: 0x001A1774
        private static object OnCoerceContentTemplateSelector(DependencyObject d, object baseValue)
        {
            DataGridDetailsPresenter dataGridDetailsPresenter = d as DataGridDetailsPresenter;
            DataGridRow dataGridRowOwner  = dataGridDetailsPresenter.DataGridRowOwner;
            DataGrid    grandParentObject = (dataGridRowOwner != null) ? dataGridRowOwner.DataGridOwner : null;

            return(DataGridHelper.GetCoercedTransferPropertyValue(dataGridDetailsPresenter, baseValue, ContentPresenter.ContentTemplateSelectorProperty, dataGridRowOwner, DataGridRow.DetailsTemplateSelectorProperty, grandParentObject, DataGrid.RowDetailsTemplateSelectorProperty));
        }
 /// <summary> 
 /// AutomationPeer for DataGridDetailsPresenter
 /// </summary> 
 /// <param name="owner">DataGridDetailsPresenter</param>
 public DataGridDetailsPresenterAutomationPeer(DataGridDetailsPresenter owner)
     : base(owner)
 { 
 }
        /// <summary>
        /// ContentHeightProperty property changed handler.
        /// </summary>
        /// <param name="d">DataGridDetailsPresenter.</param>
        /// <param name="e">DependencyPropertyChangedEventArgs.</param>
        private static void OnContentHeightPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            DataGridDetailsPresenter detailsPresenter = (DataGridDetailsPresenter)d;

            detailsPresenter.InvalidateMeasure();
        }
        /// <summary>
        /// Builds the visual tree for the column header when a new template is applied.
        /// </summary>
        public override void OnApplyTemplate()
        {
            this.RootElement = GetTemplateChild(DATAGRIDROW_elementRoot) as Panel;
            //
            if (this.RootElement != null)
            {
                EnsureBackground();
                ApplyState(false /*animate*/);
            }

            bool updateVerticalScrollBar = false;
            if (this._cellsElement != null)
            {
                // If we're applying a new template, we  want to remove the cells from the previous _cellsElement
                this._cellsElement.Children.Clear();
                updateVerticalScrollBar = true;
            }

            this._cellsElement = GetTemplateChild(DATAGRIDROW_elementCells) as DataGridCellsPresenter;
            if (this._cellsElement != null)
            {
                this._cellsElement.OwningRow = this;
                // Cells that were already added before the Template was applied need to
                // be added to the Canvas
                if (this.Cells.Count > 0)
                {
                    foreach (DataGridCell cell in this.Cells)
                    {
                        this._cellsElement.Children.Add(cell);
                    }
                }
            }

            _detailsElement = GetTemplateChild(DATAGRIDROW_elementDetails) as DataGridDetailsPresenter;
            if (_detailsElement != null && this.OwningGrid != null)
            {
                _detailsElement.OwningRow = this;
                if (this.ActualDetailsVisibility == Visibility.Visible && this.ActualDetailsTemplate != null && this._appliedDetailsTemplate == null)
                {
                    // Apply the DetailsTemplate now that the row template is applied.
                    SetDetailsVisibilityInternal(this.ActualDetailsVisibility, _detailsVisibilityNotificationPending /*raiseNotification*/, false /*animate*/);
                    _detailsVisibilityNotificationPending = false;
                }
            }

            _bottomGridLine = GetTemplateChild(DATAGRIDROW_elementBottomGridLine) as Rectangle;
            EnsureGridLines();

            _headerElement = GetTemplateChild(DATAGRIDROW_elementRowHeader) as DataGridRowHeader;
            if (_headerElement != null)
            {
                _headerElement.Owner = this;
                if (this.Header != null)
                {
                    _headerElement.Content = Header;
                }
                EnsureHeaderStyleAndVisibility(null);
            }

            // The height of this row might have changed after applying a new style, so fix the vertical scroll bar
            if (this.OwningGrid != null && updateVerticalScrollBar)
            {
                this.OwningGrid.UpdateVerticalScrollBar();
            }
        }