Back to Devexpress

DialogEditFormBehavior.CreateEditItemViewModel Event

wpf-devexpress-dot-xpf-dot-grid-dot-dialogeditformbehavior.md

latest3.8 KB
Original Source

DialogEditFormBehavior.CreateEditItemViewModel Event

Occurs before a user invokes the dialog edit form. This event allows you to specify a view model for the edit operation.

Namespace : DevExpress.Xpf.Grid

Assembly : DevExpress.Xpf.Grid.v25.2.Extensions.dll

NuGet Package : DevExpress.Wpf.Grid.Core

Declaration

csharp
public event EventHandler<CreateEditItemViewModelArgs> CreateEditItemViewModel
vb
Public Event CreateEditItemViewModel As EventHandler(Of CreateEditItemViewModelArgs)

Event Data

The CreateEditItemViewModel event's data class is CreateEditItemViewModelArgs. The following properties provide information specific to this event:

PropertyDescription
GetViewModelAsyncGets or sets the task that returns the edit operation’s view model. The view model includes an item that you want to edit or add to the GridControl, the data context that describes the edit operation, and the dialog edit form ‘s title.
IsNewItemGets whether a user invokes the dialog edit form to add a new item to the GridControl.
KeyGets the value of the field assigned to the DialogEditFormBehavior.KeyProperty property.
ViewModelGets or sets the view model used in the edit operation. The view model includes an item that you want to edit or add to the GridControl, the data context that describes the edit operation, and the dialog edit form‘s title.

Remarks

Before a user invokes the dialog edit form , the behavior raises the CreateEditItemViewModel event and executes the CreateEditItemViewModelCommand.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the CreateEditItemViewModel event.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

wpf-data-grid-implement-crud-operations/CS/CodeBehind/EntityFramework/InstantFeedbackMode/MainWindow.xaml#L47

xml
<dxg:DialogEditFormBehavior x:Name="EditFormBehavior" KeyProperty="Id"
                            CreateEditItemViewModel="OnCreateEditEntityViewModel" ValidateRow="OnValidateRow"
                            ValidateRowDeletion="OnValidateRowDeletion">

See Also

DialogEditFormBehavior Class

DialogEditFormBehavior Members

DevExpress.Xpf.Grid Namespace