# 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](https://www.telerik.com/products/wpf/documentation/controls/radpropertygrid/getting-started/getting-started) help article.

### Default

The default option behaves similarly for both **Flat and Hierarchical** [RenderMode](https://www.telerik.com/products/wpf/documentation/controls/radpropertygrid/features/layout-rendering-modes). 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.

**Example 1: RadPropertyGrid with Default EditMode**

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

> caption RadPropertyGrid with default EditMode

![Rad Property Grid Edit Modes Default](https://www.telerik.com/products/wpf/documentation/assets/c27f81735c24bd94ff771461cd6cfbdd/radpropertygrid_editmodes_default.png)

### 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](https://www.telerik.com/products/wpf/documentation/controls/radpropertygrid/features/defining-propertysets).

> important **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](https://www.telerik.com/products/wpf/documentation/controls/radpropertygrid/features/layout-rendering-modes) article.

**Example 2: RadPropertyGrid with EditMode set to Single**

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

> caption RadPropertyGrid with single EditMode

![Rad Property Grid Edit Modes Single](https://www.telerik.com/products/wpf/documentation/assets/23d9f2bab504e373c7dac2008e51fbf5/radpropertygrid_editmodes_single.png)

## 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:

**Example 3: Canceling the edit as BeginningEdit event is raised**

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

```VB.NET
	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](https://www.telerik.com/products/wpf/documentation/controls/radpropertygrid/features/keyboard-support) (i.e. clicking on a display TextBlock triggers edit, pressing Esc cancels edit etc).

## See Also

* [Getting Started with RadPropertyGrid](https://www.telerik.com/products/wpf/documentation/controls/radpropertygrid/getting-started/getting-started)

* [Layout Rendering Modes](https://www.telerik.com/products/wpf/documentation/controls/radpropertygrid/features/layout-rendering-modes)

* [Keyboard Support](https://www.telerik.com/products/wpf/documentation/controls/radpropertygrid/features/keyboard-support)

* [Defining Property-Sets](https://www.telerik.com/products/wpf/documentation/controls/radpropertygrid/features/defining-propertysets)
