/// <summary> /// Called when ContentProperty is invalidated on "d." /// </summary> private static void OnContentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { GridViewRowPresenter gvrp = (GridViewRowPresenter)d; // // If the old and new value have the same type then we can save a lot of perf by // keeping the existing ContentPresenters // Type oldType = (e.OldValue != null) ? e.OldValue.GetType() : null; Type newType = (e.NewValue != null) ? e.NewValue.GetType() : null; // DisconnectedItem doesn't count as a real type change if (e.NewValue == BindingExpressionBase.DisconnectedItem) { gvrp._oldContentType = oldType; newType = oldType; } else if (e.OldValue == BindingExpressionBase.DisconnectedItem) { oldType = gvrp._oldContentType; } if (oldType != newType) { gvrp.NeedUpdateVisualTree = true; } else { gvrp.UpdateCells(); } }
// Token: 0x06004DA3 RID: 19875 RVA: 0x0015DE10 File Offset: 0x0015C010 private static void OnContentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { GridViewRowPresenter gridViewRowPresenter = (GridViewRowPresenter)d; Type type = (e.OldValue != null) ? e.OldValue.GetType() : null; Type right = (e.NewValue != null) ? e.NewValue.GetType() : null; if (e.NewValue == BindingExpressionBase.DisconnectedItem) { gridViewRowPresenter._oldContentType = type; right = type; } else if (e.OldValue == BindingExpressionBase.DisconnectedItem) { type = gridViewRowPresenter._oldContentType; } if (type != right) { gridViewRowPresenter.NeedUpdateVisualTree = true; return; } gridViewRowPresenter.UpdateCells(); }
internal void UpdateRowArea(GridViewRowPresenter gridPresenter) { if (gridPresenter == null) { // happens due to virutalization return; } ContentPresenter _cellContent = null; FrameworkElement _cellElement = null; for (int i=0; i<gridPresenter.Columns.Count; i++) { _cellContent = VisualTreeHelper.GetChild(gridPresenter, i) as ContentPresenter; _cellElement = ElementHelper.FindVisualChild<FrameworkElement>(_cellContent); if (_cellElement != null) { _cellElement.InvalidateMeasure(); _cellElement.InvalidateArrange(); _cellElement.UpdateLayout(); } } }