Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DataFormCustomItem Class

Stores settings of the data form’s custom editor.

Namespace: DevExpress.Maui.DataForm

Assembly: DevExpress.Maui.Editors.dll

NuGet Package: DevExpress.Maui.Editors

#Declaration

C#
[ContentProperty("EditorView")]
public class DataFormCustomItem :
    DataFormItem,
    IVisualTreeElement

#Remarks

If you create a DateFormCustomItem and add an editor inside, you can bind the editor’s properties to any properties from the underlying data object. To edit a property value to which the DataFormCustomItem is bound (via the DataFormItem.FieldName property) and utilize DataFormView’s validation mechanism, use the DataFormCustomItem.EditorValue property.

#Example

To create a custom editor on a data form, add the DataFormCustomItem item to the data form’s Items collection and set the EditorView property to a View class descendant that specifies a view or layout.

The binding context of the data form’s custom editor is an object assigned to the DataFormView.DataObject property. You can bind a custom editor view’s property to any property of this object.

Note

DataFormCustomItem.EditorView is a content property. You can skip property tags in the markup.

In this example, the data form is associated with an EmployeeInfo object. The Image view is added to the form as a custom editor and bound to the EmployeeInfo.PhotoPath property to display an employee photo.

View Example

DevExpress MAUI DataForm - CustomEditor

<dx:DataFormCustomItem FieldName="PhotoPath">
    <dx:DXStackLayout Padding="16">
        <Frame Padding="0"
               HorizontalOptions="Center"
               BorderColor="#dadada"
               WidthRequest="100"
               HeightRequest="100"
               CornerRadius="50"
               IsClippedToBounds="True">
            <dx:DXImage Source="{Binding PhotoPath}"
                   BackgroundColor="Gray"
                   Aspect="AspectFill"/>
        </Frame>
    </dx:DXStackLayout>
</dx:DataFormCustomItem>

When you define a custom editor for the data form, you can bind the custom editor property to any property of the data object (it is the binding context of the data form’s custom editors). Note, in this case, the data form’s built-in validate and commit mechanisms are not available for the custom editor. If you need to validate and commit values entered within the custom editor, bind its value property to the EditorValue property.

#Implements

Microsoft.Maui.IFrameworkElement
Microsoft.Maui.Controls.ITabStopElement

#Inheritance

See Also