Back to Devexpress

EditRowViewModel Class

maui-devexpress-dot-maui-dot-datagrid-f7d03e0e.md

latest2.7 KB
Original Source

EditRowViewModel Class

Contains information on a data row that a user currently edits in the edit form.

Namespace : DevExpress.Maui.DataGrid

Assembly : DevExpress.Maui.DataGrid.dll

NuGet Package : DevExpress.Maui.DataGrid

Declaration

csharp
public class EditRowViewModel :
    INotifyPropertyChanged

Remarks

An EditRowViewModel object serves as a binding context for a template that defines the presentation of the grid’s edit form (EditFormPage).

Example

This example shows how to create a custom view for the grid’s edit form and set up the grid to invoke this form when a user double taps a cell.

The grid is bound to a collection of Employee objects and contains columns to display employee information (photo, name, position, phone, address, hire and birth dates, access level, and information about vacation). A custom edit form will display an employee’s photo and name, and contain editors to modify employee’s phone and address.

Custom Edit Form

Grid Columns

Follow the steps below to implement a custom edit form.

  1. Define a data template to be a content for the edit form page. In this example, it is a Grid with a set of labels and editors inside. Its BindingContext is an EditRowViewModel object. Use its Item property to access an object that represents a data source’s record (Employee) and bind editors to its properties.

  2. In the grid’s DoubleTap event handler, create an EditFormPage instance and pass the specified data template to its constructor as a third parameter.

  3. In the App.xaml.cs file, assign a NavigationPage instance to the Application.MainPage property and add the MainPage content page to the navigation stack (the application’s root page):

Implements

INotifyPropertyChanged

Inheritance

System.Object EditRowViewModel

Extension Methods

Yield<EditRowViewModel>()

YieldIfNotNull<EditRowViewModel>()

See Also

EditRowViewModel Members

DevExpress.Maui.DataGrid Namespace