Editor
in namespace DotVVM.AutoUI.Controls
Creates the editor for the specified property using the metadata information.
Usage & Scenarios
Generates an editor control for the specified property based on DotVVM Auto UI model metadata.
Sample 1: Basic Editor
The Property
property is bound to the property in the viewmodel which shall be edited.
Because the property is of type string
, the TextBox control will be used.
<auto:Editor Property="{value: FirstName}" />
public class ViewModel : DotvvmViewModelBase
{
public string FirstName { get; set; }
}
Sample 2: Other Editor properties
The Changed
event will be triggered when the user changes the value in the editor.
The Enabled
property indicates whether the control will be editable or not.
Since the editors are bound to bool
properties, the CheckBox controls will be generated.
<auto:Editor Property="{value: ConfirmOrder}" />
<auto:Editor Property="{value: AgreeWithConditions}"
Enabled="{value: ConfirmOrder}"
Changed="{command: OnAgreeChanged()}" />
public class ViewModel : DotvvmViewModelBase
{
public bool AgreeWithConditions { get; set; }
public bool ConfirmOrder { get; set; }
public void OnAgreeChanged()
{
// TODO
}
}
Properties
Name | Type | Description | Notes | Default Value | |
---|---|---|---|---|---|
ClientIDMode | ClientIDMode | Gets or sets the client ID generation algorithm. |
attribute
static value
|
Static | |
DataContext | Object | Gets or sets a data context for the control and its children. All value and command bindings are evaluated in context of this value. The DataContext is null in client-side templates. |
attribute
bindable
|
null | |
Enabled | Boolean |
attribute
static value
bindable
|
True | ||
ID | String | Gets or sets the control client ID within its naming container. |
attribute
static value
bindable
|
null | |
IncludeInPage | Boolean | Gets or sets whether the control is included in the DOM of the page. |
attribute
bindable
|
True | |
OverrideTemplate | ITemplate |
inner element
static value
|
null | ||
Property | IValueBinding |
attribute
bindable
|
null | ||
Visible | Boolean | Gets or sets whether the control is visible. When set to false, `style="display: none"` will be added to this control. |
attribute
static value
bindable
|
True |
Events
Name | Type | Description | |
---|---|---|---|
Changed | ICommandBinding |