Editing
The PropertyGrid control allows you to edit the property values displayed in the UI. There are several different settings that can be used to adjust the editing process.
Default Editors
There are several default editor controls that are used for the different property types.
-
CheckBox—For
bool
values. -
RadDateTimePicker—For
DateTime
values. -
ColorPicker—For
Color
values. - RadCollectionEditorPicker—For collections.
- ComboBox—For enum values.
- FlagEnumEditor—For flag enum values.
- TextBox—For text and other values.
Replacing the Default Editor
The default generated editors can be replaced via the EditorAttribute or the EditorTemplate
property of the PropertyDefinition.
The EditorAttribute
can be assigned to a property in the data item's model. It allows you to set the type of the editor control that should be generated in the UI. See how to use the EditorAttribute
in the Attributes Support article.
The EditorTemplate
allows you to define a DataTemplate
and setup the needed UI in XAML.
Using EditorTemplate
<telerikControls:RadPropertyGrid AutoGeneratePropertyDefinitions="False">
<telerikControls:RadPropertyGrid.PropertyDefinitions>
<propertyGrid:PropertyDefinition DisplayName="Value" Binding="{Binding Value}" >
<propertyGrid:PropertyDefinition.EditorTemplate>
<DataTemplate>
<telerikInput:RadNumericBox Value="{Binding Value, Mode=TwoWay}"/>
</DataTemplate>
</propertyGrid:PropertyDefinition.EditorTemplate>
</propertyGrid:PropertyDefinition>
<!-- other property definitions here -->
</telerikControls:RadPropertyGrid.PropertyDefinitions>
</telerikControls:RadPropertyGrid>
xmlns:telerikControls="using:Telerik.UI.Xaml.Controls"
xmlns:propertyGrid="using:Telerik.UI.Xaml.Controls.Data.PropertyGrid"
xmlns:telerikInput="using:Telerik.UI.Xaml.Controls.Input"
Edit Modes
By default all properties are in edit mode and their editors are enabled. To change this, set the EditMode
property of RadPropertyGrid
to Single
. This will allow only one editor to be editable at a time. To return the default behavior set the EditMode
to Default
.
Default EditMode
Setting the EditMode
<telerikControls:RadPropertyGrid EditMode="Single"/>