Edit this page

Edit Modes

RadPropertyGrid exposes EditMode property of type PropertyGridEditMode, which provides different options for editing behavior.

Edit Modes

As to configuring RadPropertyGrid and assigning an Item to it, please check the Getting Started with RadPropertyGrid help article.

Default

The default option behaves similarly for both Flat and Hierarchical RenderMode. It utilizes much lighter UI, but also provides fewer options:

  1. All PropertyGridFields editors are accessible from the UI and the correctness of an edit operation is ensured only by the data-binding mechanism.

  2. There are not distinct visual states of PropertyGridField that indicate whether it is being currently edited, or not.

  3. When a validation error occurs, users are not encouraged to fix it, or cancel their change, by blocking the UI.

[XAML] Example 1: RadPropertyGrid with Default EditMode

<telerik:RadPropertyGrid RenderMode="Flat" EditMode="Default"/>

Figure 1: RadPropertyGrid with Default EditMode

Rad Property Grid Edit Modes Default

Single

Single EditMode introduces the concept of editing properties one at a time. An editor is created only for the currently edited property. The other values are displayed in TextBlocks

It relies on PropertyDefinition’s Binding property. Setting this mode is not supported with dynamic data or when Property-Sets are defined.

Single EditMode is supported only when RenderMode is set to Flat. For more information on the different rendering modes, please check the Layout Rendering Modes article.

[XAML] Example 2: RadPropertyGrid with EditMode set to Single

<telerik:RadPropertyGrid RenderMode="Flat" EditMode="Single"/>

Figure 2: RadPropertyGrid with Single EditMode

Rad Property Grid Edit Modes Single

Events

The BeginningEdit and EditEnded events are raised only if the EditMode property is set to Single.

BeginEdit

BeginEditMethod has two overloads:

  1. BeginEdit(): Starts an edit operation for the current PropertyDefinition.

  2. BeginEdit(PropertyDefinition propertyDefinition): Starts an edit operation for the PropertyDefinition that is passed as a parameter.

If the edit operation is successfully initiated, RadPropertyGrid’s BeginningEdit event is raised . It is a cancellable event so one can prevent the edit operation there, in accordance to some custom logic:

[C#] Example 3: Canceling the edit as BeginningEdit event is raised

void RpgBeginningEdit(object sender, PropertyGridBeginningEditEventArgs e)
{
    // Custom logic
    e.Cancel = true;
}

[VB] Example 3: Canceling the edit as BeginningEdit event is raised

Private Sub RpgBeginningEdit(sender As Object, e As PropertyGridBeginningEditEventArgs)
    ' Custom logic
    e.Cancel = True
End Sub

Then PropertyGridField’s display content (TextBlock) is replaced by an editor.

Finishing Edit

There are two alternative options for finishing an edit operation:

  1. CommitEdit: Tries to change the value of the bound property. First, it invokes the validation logic (raising the Validating, Validated events).

  2. CancelEdit: Reverts the old value without validating the new ones.

Both operations result in raising of the EditEnded event, which indicates the executed operation and the Old and New value after it.

These edit actions are integrated with RadPropertyGrid’s Keyboard navigation (i.e. clicking on a display TextBlock triggers edit, pressing Esc cancels edit etc).

See Also