It can automatically generate a matching editor collection for the attributes in the model object.
1 2 3
[TemplatePart(Name = ElementItemsControl, Type = typeof(ItemsControl))] [TemplatePart(Name = ElementSearchBar, Type = typeof(SearchBar))] publicclassPropertyGrid : Control
Let’s take PlainTextPropertyEditor as an example. When we need to customize the editor, we can inherit from PropertyEditorBase and override some methods. The definitions of these methods are shown in the following table:
Methods
Name
Description
Remarks
CreateElement
Create specific operation controls
Must be rewritten
CreateBinding
Create data binding for specific operation controls
GetDependencyProperty
Get the dependency property that needs to be bound in the specific operation control
Must be rewritten
GetBindingMode
Get binding mode
GetUpdateSourceTrigger
Get the trigger mode of updating the data source
GetConverter
Get the converter to be used when binding
The specific operation control of the plain text editor can be TextBox: