Property Editor

Open Home → Controls gallery → Property Editor. The gallery shows independent editor instances over shared demo-model values, including unit selectors, switches, sliders, and the extended layout.
PropertyEditorViewModel groups heterogeneous property view models into one form. The compact PropertyEditorView and wide ExtendedPropertyEditorView render the same property types. Choose the wide layout when descriptions and labels need a dedicated row; choose the compact layout for a sidebar or a dense settings panel.
Registration and presentation
The default RegisterCore() path registers the standard controls. When configuring controls explicitly, include RegisterPropertyEditor() in the controls builder callback:
A custom callback replaces the corresponding default registration list. Register other control families your application uses as well. The property editor registration maps both editor view models and the built-in text, combo box, toggle group, unit, slider, switch, and button view models to views. A custom property type needs its own view-locator mapping.
In a view with the framework view locator configured, present the editor as content:
Connect properties to a model
This complete view-model example uses shared reactive model values. Its editor owns the property view models; the containing view model owns the editor and model subscriptions.
Replace the constructor with new ExtendedPropertyEditorViewModel("properties") to use the wide layout. Its outer row keeps the property icon while the inner control suppresses its duplicate prefix through PropertyEditorDisplayOptions.ShowPrefixIcon.
Choose a property adapter
Type | Use |
|---|---|
| Edit a |
| Read and write text through asynchronous callbacks and receive external updates through an |
| Edit a reactive Boolean. |
| Edit a reactive number with explicit minimum and maximum. |
| Select an |
| Present selection items as a button group. |
| Edit a numeric model value through an |
| Run an asynchronous action with optional reactive availability. |
PropertyTextBoxViewModel.Text is the editable buffer. ApplyFromUserCommand submits it; CancelCommand restores the last model text. IsInEditMode, IsSync, HasValidationErrors, and ErrorMessage distinguish editing, synchronization, validation, and operation failures. A callback adapter's Refresh(CancellationToken) performs its read callback; construction does not perform that read. Supply an update stream for later model changes and perform the initial refresh yourself.
PropertyUnitReactive(string id, IUnit unit, ReactiveProperty<double> model, ...) works with the unit's numeric model representation and validates the SI value. Obtain units from IUnitService; do not implement display conversion by changing the stored model value. See Unit Service for unit registration and conversion rules.
Text adapters enable text undo by default through enableUndo. Unit properties use separate value and unit undo entries; avoid adding a second text history layer. Attach the editor to the application's view-model tree so routed operations reach the appropriate controller. See Undo and Redo.
Filter advanced properties
Configure a property's scopes before adding it. An unscoped property is always included. A scoped property is included when any of its scopes appears in the editor's DisplayScopes set.
Here diagnosticsModel is an existing ReactiveProperty<bool> and editor is the owning editor. Bind the view to Items, the filtered collection, rather than ItemsSource. Changing the editor's scope set refreshes the filter. The current implementation does not subscribe to each property's scope collection, so do not rely on changing property scopes after insertion to refresh a row.
Ownership and practical limits
The editor assigns itself as parent of added properties and disposes removed properties. Disposing the editor clears and disposes its remaining items. Removing a property is therefore a lifetime operation, not a way to temporarily hide it; use display scopes for that.
Create separate property view-model instances for each editor, even when several editors share the same reactive model. Do not attach one property instance to two visual trees. Dispose the shared model at its actual owner, after its editors no longer use it.
ShowHeader controls the editor's label presentation. Header, ShortHeader, Description, Icon, IconColor, and Menu belong to individual properties. Descriptions use the restricted native Markdown and Palette syntax. UI presentation state can be restored through Layout Persistence; application settings still require an application store.
The running example's Controls Gallery → Property Editor demonstrates compact editors sharing model values, the extended layout, scopes, units, validation, and property error menus. Consult PropertyEditorPageViewModel for a larger composition and PropertyEditorViewModelTest for scope and ownership examples.