The default method of editing object properties in WinForms XAF applications is to choose an object from the List View, invoke the Detail View in a separate window, edit properties and save an object. In ASP.NET Web XAF applications, when you click an object in a List View, a corresponding Detail View is first opened in View mode. Then, you can use the SwitchToEditMode action to switch the Detail View to the Edit mode. However, the default functionality can be extended. For instance, properties displayed in a List View can be edited in place, as in a spreadsheet editor. This topic describes additional functionality available to XAF ASP.NET and WinForms applications, and explains how it can be enabled. Mobile applications does not support in-place editing.
The following image illustrates an editable List View in WinForms and ASP.NET applications.
In a WinForms XAF application, an existing object can be edited by selecting a row and clicking the property cell, and a new object can be added by clicking the new item row. In an ASP.NET XAF application, an existing object can be edited and a new object can be created by clicking the Edit () and New () buttons located in a row. To enable this functionality, perform the following steps.
When the split layout is activated, the Detail View is displayed together with the List View in the same window. The detail View displays the currently selected object properties. The Detail View content changes dynamically, depending on the current object focused in the List View. The following image illustrates the split layout.
To enable the split layout for a specific List View, perform the following steps.
An object can have several Detail Views available. The IModelListView.MasterDetailView property allows you to specify the Detail View that will represent the object currently selected in the List View. If this property value is empty, the IModelListView.DetailView value is used. If both MasterDetailView and DetailView properties are unspecified, then the IModelClass.DefaultDetailView value specified for the current object type is used.
The WinForms application default behavior is to display the confirmation dialog if an end-user focuses another element in the window after editing a cell (either using the in-place editor or using the Detail View).
The changes made in an editable List View can be saved automatically, without confirmation, when selecting another object in the View or focusing another element in the window. Use the ModificationsController.ModificationsHandlingMode and ModificationsController.ModificationsCheckingMode properties to change the desired behavior for editable List Views.
In addition to the standard Edit Action, ASP.NET Web XAF applications have a special InlineEdit Action. Although this Action belongs to the standard RecordEdit category, it is not displayed on the main toolbar. Instead, it is displayed in a List Editor's context menu and processed by the List Editor internally. To customize the in-place edit mode in an ASP.NET application, use the IModelListViewWeb.InlineEditMode property of a Views | <ListView> node.
This property is considered by the ASPxGridListEditor when the IModelView.AllowEdit property is set to True. The following table explains and illustrates possible values of the InlineEditMode property.
|EditForm||Cell values are edited with the Edit Form. The data row whose values are currently being edited is not displayed.|
|EditFormAndDisplayRow||Cell values are edited with the Edit Form. The data row whose values are currently being edited is displayed above the Edit Form.|
|Inline||Cell values are edited within the Inline Edit Row.|
|PopupEditForm||Cell values are edited with the Popup Edit Form.|
|Batch||Enables the Batch Edit Mode. The data rows whose values are currently being edited are saved only on clicking the Save changes button. Unlike other modes, in this mode you can edit multiple rows and then click Save changes to save all modified objects at once.|
The Batch Edit Mode has certain specificities:
The eXpress Application Framework provides two edit modes for collection properties in an ASP.NET Web application.
By default, collection properties are always displayed in a Detail View, but can only be modified when the Detail View is in edit mode.
Collection properties are not displayed in Edit mode. Instead, they are displayed and can be modified in View mode.
The mode can be specified globally using the WebApplication.CollectionsEditMode property (see How to: Hide Collection Properties in an Edit Mode Detail View for an ASP.NET Application). To change the mode for an individual List View, use the IModelDetailViewWeb.CollectionsEditMode property in the Model Editor.