The requested page is not available for the requested platform. You are viewing the content for Default platform.
A newer version of this page is available. Switch to the current version.

How to: Customize a Built-in Property Editor (Mobile)

  • 2 min to read

This topic describes how to customize a built-in XAF Property Editor for Mobile applications (refer to the How to: Customize a Built-in Property Editor (WinForms) and How to: Customize a Built-in Property Editor (ASP.NET) topics to see the similar examples for WinForms and ASP.NET). In this example, the MobileDateTimePropertyEditor is customized to display the date and time:


Inherit the Property Editor

In the Mobile module project, create a MobileDateTimePropertyEditor descendant. Note that your editor should be public. Override the CreateEditModeControlCore method to customize the Property Editor's control the edit mode uses. In this example, we customize the DateBox control that uses the dxDateBox widget by applying the PropertyEditorAttribute attribute to specify that the Property Editor can be used for the DateTime type properties:

using DevExpress.ExpressApp.Editors;
using DevExpress.ExpressApp.Mobile.Editors;
using DevExpress.ExpressApp.Mobile.MobileModel;
using DevExpress.ExpressApp.Model;
// ...
[PropertyEditor(typeof(DateTime), false)]
public class CustomDateTimePropertyEditor : MobileDateTimePropertyEditor {
    public CustomDateTimePropertyEditor(Type objectType, IModelMemberViewItem info) :
        base(objectType, info) { }
    protected override Component CreateEditModeControlCore() {
        DateBox control = (DateBox)base.CreateEditModeControlCore();
        control["format"] = "datetime";
        return control;

All the DateBox control's dictionary keys coincide with the corresponding DevExtreme dxDateBox widget's properties, except the "type" key that is a reserved word.

Use the Customized Property Editor

To use the implemented Property Editor for a specific property, run the Model Editor in the Mobile project and set the required OwnMember or ViewItem node's PropertyEditorType property to CustomDateTimePropertyEditor. To use the implemented Property Editor for all DateTime properties, set the PropertyEditorAttribute constructor's defaultEditor parameter to true in the code above.