

'Declaration<TypeDescriptionProviderAttribute(MS.Internal.ComponentModel.DependencyObjectProvider)> <NameScopePropertyAttribute("NameScope", System.Windows.NameScope)> Public MustInherit Class EditorDefinitionBase Inherits PropertyDefinitionBase
'UsageDim instance As EditorDefinitionBase
[TypeDescriptionProvider(MS.Internal.ComponentModel.DependencyObjectProvider)] [NameScopeProperty("NameScope", System.Windows.NameScope)] public abstract class EditorDefinitionBase : PropertyDefinitionBase
EditorDefinitionBase-derived classes allow you to customize how the values of your properties are displayed in the PropertyGrid. These instances should be added to PropertyGrid.EditorCollections collection.
An "editor definition" is used to instantiate the editor (e.g., FrameworkElement instances) for one or more properties. The EditorDefinitionBase.TargetProperties property allows you to specify the definition keys that identify the ^properties targeted by the editor definition. TargetProperties is a collection of objects that contains custom keys (e.g., usually a string) or Type keys (e.g., instance of Type class).
When preparing a PropertyItemBase instance to be displayed by the PropertyGrid, the PropertyGrid will try to create an editor for the PropertyItemBase instance unless the PropertyItemBase.Editor property is already initialized by the user (see PropertyGrid.PropertyContainerStyle property and PropertyGrid.PreparePropertyItem event).
If the Editor property is not initialized, the EditorDefinitionCollection will be consulted to determine the corresponding editor to display.
The priority of the definition keys to be used in order to find the appropriate editor for the property item is as follows:
1. The value provided by the PropertyItemBase.DefinitionKey property.
2. The value of the binding result of PropertyGrid.PropertyNameBinding applied on the underlying item.
3. The value type (e.g., value.GetType()) of the binding result of PropertyGrid.PropertyValueBinding applied on the underlying item. (A lookup based on a Type instance will recursively perform the look-up using base classes to find any matching editor definition.)
4. If PropertyGrid.PropertyValueBinding is null, the type of the underlying item. (A lookup based on a Type instance will recursively perform the look-up using base classes to find any matching editor definition.)
When no specific EditorDefinitionBase is found in the PropertyGrid.EditorDefinitions collection, the PropertyGrid will try to automatically create an appropriate editor based on the type of the value. (See default editors.)
If no appropriate editor is found, the EditorDefintionBase found in the PropertyGrid.DefaultEditorDefinition will be used.
Finally, if no editor is created, a TextBlock will be used to display the value.
The following is a list of the default editors that are automatically instantiated based on the type of the targeted property (when using SelectedObject[s]) or the type of the Value of the property (when using Properties or PropertiesSource).
- bool: CheckBox
- DateTime: DateTimeUpDown
- Color: ColorPicker
- decimal: DecimalUpDown
- double: DoubleUpDown
- float: SingleUpDown
- byte: ByteUpDown
- sbyte: SByteUpDown*
- short: ShortUpDown
- ushort: UShortUpDown*
- int: IntegerUpDown
- uint: UIntegerUpDown*
- long: LongUpDown
- ulong: ULongUpDown*
- enum: ComboBox with fields in the enumeration
- FontFamily: ComboBox populated with the available font families
- FontWeight: ComboBox populated with the possible font weights
- FontStyle: ComboBox populated with the possible font styles
- FontStretch: ComboBox populated with the possible font stretches
For CLS compliance, these editor are not available on the public API.
When using SelectedObject[s] only:
- object: TextBox
- TimeSpan: DateTimeUpDown using a converter
- IList<T>:
a) When T is one of the primitive type or a string: PrimitiveTypeCollectionControl
b) When T is NOT a primitive type or a string : CollectionEditor
These are the available built-in EditorDefintionBase-derived classes that allow you to easily customize the display the editor of the properties.
- EditorTemplateDefinition
- EditorComboBoxDefinition
- EditorCheckBoxDefinition
- EditorColorPickerDefinition
- EditorTextDefinition
- EditorDateTimeUpDownDefinition
- EditorByteUpDownDefinition
- EditorDecimalUpDownDefinition
- EditorDoubleUpDownDefinition
- EditorIntegerUpDownDefinition
- EditorLongUpDownDefinition
- EditorShortUpDownDefinition
- EditorSingleUpDownDefinition
Each editor definition has its own custom properties that allow you to easily customize the display of the represented editor. With the exception of EditorTemplateDefinition, they all provide the EditingElementStyle that allows you to style and get a more in-depth customizing scenario.
<xctk:PropertyGrid> <xctk:PropertyGrid.EditorDefinitions> <xctk:EditorTemplateDefinition ... /> </xctk:PropertyGrid.EditorDefinitions> </xctk:PropertyGrid>
<xctk:EditorTemplateDefinition TargetProperties="FirstName,LastName" ... />
<xctk:EditorTemplateDefinition TargetProperties="{x:Type s:Int32}" ... />
<xctk:EditorTemplateDefinition ... > <xctk:EditorTemplateDefinition.TargetProperties> <s:String>Age</s:String> <xctk:TargetPropertyType Type="{x:Type s:Int32}" /> </xctk:EditorTemplateDefinition.TargetProperties> </xctk:EditorTemplateDefinition>
System.Object
System.Windows.Threading.DispatcherObject
System.Windows.DependencyObject
Xceed.Wpf.Toolkit.PropertyGrid.DefinitionBase
Xceed.Wpf.Toolkit.PropertyGrid.PropertyDefinitionBase
Xceed.Wpf.Toolkit.PropertyGrid.EditorDefinitionBase
Xceed.Wpf.Toolkit.PropertyGrid.EditorBoundDefinition
Xceed.Wpf.Toolkit.PropertyGrid.EditorComboBoxDefinition
Xceed.Wpf.Toolkit.PropertyGrid.EditorTemplateDefinition
| Name | Description | |
|---|---|---|
![]() | DependencyObjectType | (Inherited from System.Windows.DependencyObject) |
![]() | Dispatcher | (Inherited from System.Windows.Threading.DispatcherObject) |
![]() | IsSealed | (Inherited from System.Windows.DependencyObject) |
![]() | PropertyDefinitions | Gets or sets the Collection of PropertyDefinition to specify which sub-PropertyItems should be shown in the PropertyGrid. (Inherited from Xceed.Wpf.Toolkit.PropertyGrid.PropertyDefinitionBase) |
![]() | TargetProperties | (Inherited from Xceed.Wpf.Toolkit.PropertyGrid.PropertyDefinitionBase) |
| Name | Description | |
|---|---|---|
![]() | ClearValue | Overloaded. (Inherited from System.Windows.DependencyObject) |
![]() | CoerceValue | (Inherited from System.Windows.DependencyObject) |
![]() | Equals | (Inherited from System.Windows.DependencyObject) |
![]() | GetHashCode | (Inherited from System.Windows.DependencyObject) |
![]() | GetLocalValueEnumerator | (Inherited from System.Windows.DependencyObject) |
![]() | GetValue | (Inherited from System.Windows.DependencyObject) |
![]() | InvalidateProperty | (Inherited from System.Windows.DependencyObject) |
![]() | ReadLocalValue | (Inherited from System.Windows.DependencyObject) |
![]() | SetCurrentValue | (Inherited from System.Windows.DependencyObject) |
![]() | SetValue | Overloaded. (Inherited from System.Windows.DependencyObject) |
| Name | Description | |
|---|---|---|
![]() | GenerateEditingElement | |
![]() | OnPropertyChanged | (Inherited from System.Windows.DependencyObject) |
![]() | ShouldSerializeProperty | (Inherited from System.Windows.DependencyObject) |
| Name | Description | |
|---|---|---|
![]() | FindLogicalAncestor<T> | Finds the logical ancenster |
![]() | FindLogicalAncestorsAndSelf | |
![]() | FindLogicalChildren<T> | Find the logical children. |
![]() | FindVisualAncestor<T> | Finds the visual ancestor. |
![]() | FindVisualChildren<T> | Finds the visual children. |
![]() | FindVisualTreeRoot | Finds the visual tree root. |
![]() | ShowDialog | Overloaded. |
.NET: net5.0, net5.0-windows, net6.0, net6.0-macos, net6.0-windows, net7.0, net7.0-macos, net7.0-windows, net8.0, net8.0-browser, net8.0-macos, net8.0-windows, net9.0, net9.0-browser, net9.0-macos, net9.0-windows, net10.0, net10.0-browser, net10.0-macos, net10.0-windows.
.NET Framework: net40, net403, net45, net451, net452, net46, net461, net462, net463, net47, net471, net472, net48, net481.