internal static FrameworkElement GetCustomEditor(PropertyItem propertyItem, EditorDefinitionCollection customTypeEditors) { FrameworkElement editor = null; //check for custom editor if ((customTypeEditors != null) && (customTypeEditors.Count > 0)) { //first check if the custom editor is type based EditorDefinition customEditor = customTypeEditors[propertyItem.PropertyType]; if (customEditor == null) { //must be property based customEditor = customTypeEditors[propertyItem.Name]; } if (customEditor != null) { if (customEditor.EditorTemplate != null) { editor = customEditor.EditorTemplate.LoadContent() as FrameworkElement; } } } return(editor); }
internal static FrameworkElement GetTypeEditor(PropertyItem propertyItem , EditorDefinitionCollection editorDefinitions ) { FrameworkElement editor = null; //first check for an attribute editor if (editor == null) { editor = PropertyGridUtilities.GetAttibuteEditor(propertyItem); } //now look for a custom editor based on editor definitions if (editor == null) { editor = PropertyGridUtilities.GetCustomEditor(propertyItem, editorDefinitions); } //guess we have to use the default editor if (editor == null) { editor = PropertyGridUtilities.CreateDefaultEditor(propertyItem); } return(editor); }
public PropertyGrid() { _properties = new PropertyItemCollection(new ObservableCollection <PropertyItem>()); EditorDefinitions = new EditorDefinitionCollection(); PropertyDefinitions = new PropertyDefinitionCollection(); AddHandler(PropertyItem.ItemSelectionChangedEvent, new RoutedEventHandler(OnItemSelectionChanged)); AddHandler(PropertyItem.ItemOrderingChangedEvent, new RoutedEventHandler(OnItemOrderingChanged)); CommandBindings.Add(new CommandBinding(PropertyGridCommands.ClearFilter, ClearFilter, CanClearFilter)); }
public PropertyGrid() { _propertyDefinitionsListener = new WeakEventListener <NotifyCollectionChangedEventArgs>(this.OnPropertyDefinitionsCollectionChanged); _editorDefinitionsListener = new WeakEventListener <NotifyCollectionChangedEventArgs>(this.OnEditorDefinitionsCollectionChanged); UpdateContainerHelper(); EditorDefinitions = new EditorDefinitionCollection(); PropertyDefinitions = new PropertyDefinitionCollection(); AddHandler(PropertyItemBase.ItemSelectionChangedEvent, new RoutedEventHandler(OnItemSelectionChanged)); AddHandler(PropertyItemsControl.PreparePropertyItemEvent, new PropertyItemEventHandler(OnPreparePropertyItemInternal)); AddHandler(PropertyItemsControl.ClearPropertyItemEvent, new PropertyItemEventHandler(OnClearPropertyItemInternal)); CommandBindings.Add(new CommandBinding(PropertyGridCommands.ClearFilter, ClearFilter, CanClearFilter)); }
protected virtual void OnEditorDefinitionsChanged(EditorDefinitionCollection oldValue, EditorDefinitionCollection newValue) { if (oldValue != null) { CollectionChangedEventManager.RemoveListener(oldValue, _editorDefinitionsListener); } if (newValue != null) { CollectionChangedEventManager.AddListener(newValue, _editorDefinitionsListener); } this.Notify(this.PropertyChanged, () => this.EditorDefinitions); }
protected virtual void OnEditorDefinitionsChanged(EditorDefinitionCollection oldValue, EditorDefinitionCollection newValue) { if (oldValue != null) { oldValue.CollectionChanged -= new NotifyCollectionChangedEventHandler(OnEditorDefinitionsCollectionChanged); } if (newValue != null) { newValue.CollectionChanged += new NotifyCollectionChangedEventHandler(OnEditorDefinitionsCollectionChanged); } UpdateProperties(true); }
public PropertyGrid() { EditorDefinitions = new EditorDefinitionCollection(); PropertyDefinitions = new PropertyDefinitionCollection(); CommandBindings.Add(new CommandBinding(PropertyGridCommands.ClearFilter, ClearFilter, CanClearFilter)); }