// IsExpanded DP private static void OnIsExpandedChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) { SubPropertyEditor theThis = obj as SubPropertyEditor; if (theThis == null) { return; } bool newIsExpanded = (bool)e.NewValue; PropertyEntry containedProperty = theThis.PropertyEntry; // Store the new expansion state if (containedProperty != null) { PropertyState state = PropertyStateContainer.Instance.GetPropertyState( ModelUtilities.GetCachedSubPropertyHierarchyPath(containedProperty)); state.SubPropertiesExpanded = newIsExpanded; } // If we are expanded but we never exposed the sub-properties to anyone before, // fire a signal saying that a list of sub-properties may be now available, so that // UI DataBindings refresh themselves if (newIsExpanded == true && theThis._exposedSubProperties == false) { theThis.FireSubPropertiesListChangedEvents(); } }
// Properties // PropertyEntry DP // When the displayed PropertyEntry changes, make sure we update the UI and hook into the // new PropertyEntry's notification mechanism private static void OnPropertyEntryChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) { SubPropertyEditor theThis = obj as SubPropertyEditor; if (theThis == null) { return; } PropertyEntry oldValue = e.OldValue as PropertyEntry; if (oldValue != null) { oldValue.PropertyValue.RootValueChanged -= new EventHandler(theThis.OnPropertyValueRootValueChanged); } PropertyEntry newValue = e.NewValue as PropertyEntry; if (newValue != null) { newValue.PropertyValue.RootValueChanged += new EventHandler(theThis.OnPropertyValueRootValueChanged); } theThis.RefreshVisuals(); }
public SubPropertyEditorAutomationPeer(SubPropertyEditor editor) : base(editor) { _editor = editor; // Hook into the VisualsChanged event so that this peer can invalidate // itself appropriately if (editor != null) { editor.VisualsChanged += new EventHandler(OnEditorVisualsChanged); } _children = new List<AutomationPeer>(); }
// CurrentQuickType DP // This method gets called when the DP changes private static void OnCurrentQuickTypeChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) { SubPropertyEditor theThis = obj as SubPropertyEditor; if (theThis == null) { return; } if (theThis._ignoreInternalChanges) { return; } theThis._quickTypeView.MoveCurrentTo(e.NewValue); theThis.ExpandSubProperties(); theThis.FireSubPropertiesListChangedEvents(); }