private void Rebuild() { SceneNodeProperty colorProperty = this.editingProperty; if (colorProperty != null && !colorProperty.IsMixedValue) { this.UpdateCurrentTab(); if (colorProperty.IsResource) { colorProperty.SceneNodeObjectSet.InvalidateLocalResourcesCache(); this.Dispatcher.BeginInvoke(DispatcherPriority.Background, (Delegate)(o => { if (this.ResourceList.IsLoaded) { this.ResourceList.ApplyTemplate(); ItemsControl itemsControl = (ItemsControl)this.ResourceList.Template.FindName("ResourcesControl", (FrameworkElement)this.ResourceList); itemsControl.ApplyTemplate(); ItemsPresenter itemsPresenter = (ItemsPresenter)itemsControl.Template.FindName("ResourcesItemsPresenter", (FrameworkElement)itemsControl); itemsPresenter.ApplyTemplate(); WorkaroundVirtualizingStackPanel virtualizingStackPanel = (WorkaroundVirtualizingStackPanel)itemsControl.ItemsPanel.FindName("VirtualizingStackPanel", (FrameworkElement)itemsPresenter); int index = -1; if (colorProperty.SelectedLocalResourceModel != null) { colorProperty.SelectedLocalResourceModel.Parent.IsExpanded = true; index = itemsControl.Items.IndexOf((object)colorProperty.SelectedLocalResourceModel); } else if (colorProperty.SelectedSystemResourceModel != null) { colorProperty.SelectedSystemResourceModel.Parent.IsExpanded = true; index = itemsControl.Items.IndexOf((object)colorProperty.SelectedSystemResourceModel); } if (index >= 0) { virtualizingStackPanel.BringIndexIntoViewWorkaround(index); } } return(null); }), null); } } this.OnPropertyChanged("EditingColor"); }
private void Rebuild() { if (this.editingProperty == null) { this.BrushSubtypeEditor = (BrushSubtypeEditor)null; } else { if (!this.editingProperty.Associated) { return; } this.oldNichedState = this.editingProperty.IsMixedValue; this.editingResource = false; bool flag = this.brushSubtypeEditor is BrushEditor.NullBrushEditor; if (this.editingProperty.IsResource) { this.editingResource = true; this.editingProperty.SceneNodeObjectSet.InvalidateLocalResourcesCache(); this.BrushSubtypeEditor = (BrushSubtypeEditor)null; this.Dispatcher.BeginInvoke(DispatcherPriority.Background, (Delegate)(o => { if (this.editingProperty != null && this.ResourceList.IsLoaded && this.Parent != null) { this.ResourceList.ApplyTemplate(); ItemsControl itemsControl = (ItemsControl)this.ResourceList.Template.FindName("ResourcesControl", (FrameworkElement)this.ResourceList); itemsControl.ApplyTemplate(); ItemsPresenter itemsPresenter = (ItemsPresenter)itemsControl.Template.FindName("ResourcesItemsPresenter", (FrameworkElement)itemsControl); itemsPresenter.ApplyTemplate(); WorkaroundVirtualizingStackPanel virtualizingStackPanel = (WorkaroundVirtualizingStackPanel)itemsControl.ItemsPanel.FindName("VirtualizingStackPanel", (FrameworkElement)itemsPresenter); int index = -1; if (this.editingProperty.SelectedLocalResourceModel != null) { this.editingProperty.SelectedLocalResourceModel.Parent.IsExpanded = true; index = itemsControl.Items.IndexOf((object)this.editingProperty.SelectedLocalResourceModel); } else if (this.editingProperty.SelectedSystemResourceModel != null) { this.editingProperty.SelectedSystemResourceModel.Parent.IsExpanded = true; index = itemsControl.Items.IndexOf((object)this.editingProperty.SelectedSystemResourceModel); } if (index >= 0) { virtualizingStackPanel.BringIndexIntoViewWorkaround(index); } } return((object)null); }), (object)null); } else if (this.editingProperty.IsMixedValue) { this.BrushSubtypeEditor = (BrushSubtypeEditor)null; } else { ITypeId typeId = (ITypeId)this.editingProperty.ComputedValueTypeId; if (typeId != null) { if (typeId.Equals((object)PlatformTypes.SolidColorBrush) && !(this.BrushSubtypeEditor is SolidColorBrushEditor)) { this.BrushSubtypeEditor = (BrushSubtypeEditor) new SolidColorBrushEditor(this, this.editingProperty); } else if (PlatformTypes.GradientBrush.IsAssignableFrom(typeId)) { if (this.BrushSubtypeEditor == null || !typeId.Equals((object)this.BrushSubtypeEditor.Category.Type)) { this.BrushSubtypeEditor = (BrushSubtypeEditor) new GradientBrushEditor(this, typeId, this.editingProperty); } } else if (PlatformTypes.TileBrush.IsAssignableFrom(typeId) && (this.BrushSubtypeEditor == null || !typeId.Equals((object)this.BrushSubtypeEditor.Category.Type))) { this.BrushSubtypeEditor = (BrushSubtypeEditor) new TileBrushEditor(this, typeId, this.editingProperty); } if (this.BrushSubtypeEditor != null) { BrushCategory.SetLastUsed(this.BrushSubtypeEditor.Category, this.editingProperty.GetValue()); } } else { this.BrushSubtypeEditor = (BrushSubtypeEditor) new BrushEditor.NullBrushEditor(); } } if (!(this.brushSubtypeEditor is BrushEditor.NullBrushEditor) && flag) { this.Dispatcher.BeginInvoke(DispatcherPriority.Background, (Delegate)(o => { this.BringIntoView(); return((object)null); }), (object)null); } this.OnEditingTypeChange(); } }