You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# DataFormView for .NET MAUI - Edit a Contact’s Data
2
2
3
-
This example demonstrates how to use a [DataFormView](https://docs.devexpress.com/MAUI/DevExpress.Maui.DataForm.DataFormView) to implement a contact edit form.
This example demonstrates how to use the [`DataFormView`](https://docs.devexpress.com/MAUI/DevExpress.Maui.DataForm.DataFormView) control to implement a contact edit form. To edit the user avatar, you can use the [`ImageEdit`](https://docs.devexpress.com/MAUI/DevExpress.Maui.Editors.ImageEdit) control.
12
4
5
+
<imgsrc="../../Images/data-form-with-image-edit-upload.png"alt="DevExpress Data Form for iOS"height="700"/> <imgsrc="../../Images/data-form-with-image-edit-bs.png"alt="DevExpress Data Form for Android"height="700"/>
13
6
14
7
## Implementation Details
15
8
16
-
17
-
* To bind a DataFormView to an object, specify the [DataFormView.DataObject](https://docs.devexpress.com/MAUI/DevExpress.Maui.DataForm.DataFormView.DataObject) property.
9
+
* Specify the [`DataFormView.DataObject`](https://docs.devexpress.com/MAUI/DevExpress.Maui.DataForm.DataFormView.DataObject) property to bind a `DataFormView` to an object.
18
10
19
-
*Specify a [DataFormView](https://docs.devexpress.com/MAUI/DevExpress.Maui.DataForm.DataFormView) editor's [FieldName](https://docs.devexpress.com/MAUI/DevExpress.Maui.DataForm.DataFormItem.FieldName) property to bind the editor to a view model's property:
11
+
*Use a `DataFormView` editor's [`FieldName`](https://docs.devexpress.com/MAUI/DevExpress.Maui.DataForm.DataFormItem.FieldName) property to bind the editor to a view model's property:
20
12
21
13
```xml
22
14
<dxdf:DataFormTextItemFieldName="FirstName" .../>
23
15
```
24
16
25
-
File to Look At: [MainPage.xaml](MainPage.xaml)
26
-
27
-
* Call the [DataFormView.Commit](https://docs.devexpress.com/MAUI/DevExpress.Maui.DataForm.DataFormView.Commit) method to validate input values and send changes to the data source.
17
+
* Call the [`DataFormView.Commit`](https://docs.devexpress.com/MAUI/DevExpress.Maui.DataForm.DataFormView.Commit) method to validate input values and send changes to the data source.
28
18
29
-
* [DataFormView](https://docs.devexpress.com/MAUI/DevExpress.Maui.DataForm.DataFormView) supports validation events and attributes. The following code uses a validation event for `Email` values:
19
+
* `DataFormView` supports validation events and attributes. The following code uses a validation event for `Email` values:
@@ -40,8 +30,6 @@ Included controls and their properties:
40
30
}
41
31
```
42
32
43
-
File to Look At: [MainPage.xaml.cs](MainPage.xaml.cs)
44
-
45
33
The following code snippet defines validation attributes for `FirstName` and `LastName` properties:
46
34
47
35
```csharp
@@ -56,20 +44,15 @@ Included controls and their properties:
56
44
}
57
45
```
58
46
59
-
File to Look At: [MainPage.xaml](MainPage.xaml)
60
-
61
-
* [DataFormView](https://docs.devexpress.com/MAUI/DevExpress.Maui.DataForm.DataFormView) automatically aligns its editors. You can customize the color and width of editor labels:
47
+
* `DataFormView` automatically aligns its editors. You can customize the color and width of editor labels:
* Embedded [DataFormView](https://docs.devexpress.com/MAUI/DevExpress.Maui.DataForm.DataFormView)'s editors contain customization options such as [LabelIcon](https://docs.devexpress.com/MAUI/DevExpress.Maui.DataForm.DataFormItem.LabelIcon), [InplaceLabelText](https://docs.devexpress.com/MAUI/DevExpress.Maui.DataForm.DataFormItem.InplaceLabelText), [LabelText](https://docs.devexpress.com/MAUI/DevExpress.Maui.DataForm.DataFormItem.LabelText), and [IsInplaceLabelFloating](https://docs.devexpress.com/MAUI/DevExpress.Maui.Editors.EditBase.IsLabelFloating).
70
-
71
-
* You can use the [LabelIcon](https://docs.devexpress.com/MAUI/DevExpress.Maui.DataForm.DataFormItem.LabelIcon) property to divide editors into visual groups. To do this, specify the [LabelIcon](https://docs.devexpress.com/MAUI/DevExpress.Maui.DataForm.DataFormItem.LabelIcon) property of the first editor in a group.
53
+
* Embedded `DataFormView`'s editors contain customization options such as [`LabelIcon`](https://docs.devexpress.com/MAUI/DevExpress.Maui.DataForm.DataFormItem.LabelIcon), [`InplaceLabelText`](https://docs.devexpress.com/MAUI/DevExpress.Maui.DataForm.DataFormItem.InplaceLabelText), [`LabelText`](https://docs.devexpress.com/MAUI/DevExpress.Maui.DataForm.DataFormItem.LabelText), and [`IsInplaceLabelFloating`](https://docs.devexpress.com/MAUI/DevExpress.Maui.Editors.EditBase.IsLabelFloating).
72
54
55
+
* You can use the `LabelIcon` property to divide editors into visual groups.
73
56
74
57
```xml
75
58
<dxdf:DataFormView ...>
@@ -78,37 +61,38 @@ Included controls and their properties:
78
61
</dxdf:DataFormView>
79
62
```
80
63
81
-
File to Look At: [MainPage.xaml](MainPage.xaml)
82
-
83
-
* If an editor's [LabelIcon](https://docs.devexpress.com/MAUI/DevExpress.Maui.DataForm.DataFormItem.LabelIcon) property is not specified, [DataFormView](https://docs.devexpress.com/MAUI/DevExpress.Maui.DataForm.DataFormView) displays the bound property's name in the editor's label area. You can set the editor's [LabelIcon](https://docs.devexpress.com/MAUI/DevExpress.Maui.DataForm.DataFormItem.LabelIcon) property to an empty string to hide this text.
64
+
* If an editor's `LabelIcon` property is not specified, `DataFormView` displays the bound property's name in the editor's label area. You can set the editor's `LabelIcon` property to an empty string to hide this text.
* [DataFormView](https://docs.devexpress.com/MAUI/DevExpress.Maui.DataForm.DataFormView) items support masks. Specify the [DataFormMaskedItem.Mask](https://docs.devexpress.com/MAUI/DevExpress.Maui.DataForm.DataFormMaskedItem.Mask) property to define a mask.
70
+
* `DataFormView` items support masks. Specify the [`DataFormMaskedItem.Mask`](https://docs.devexpress.com/MAUI/DevExpress.Maui.DataForm.DataFormMaskedItem.Mask) property to define a mask.
* Specify a [DataFormItem](https://docs.devexpress.com/MAUI/DevExpress.Maui.DataForm.DataFormItem)'s [Keyboard](https://docs.devexpress.com/MAUI/DevExpress.Maui.DataForm.DataFormTextItemBase.Keyboard) property to define a type of keyboard used to input text.
75
+
* Specify a [`DataFormItem`](https://docs.devexpress.com/MAUI/DevExpress.Maui.DataForm.DataFormItem)'s [`Keyboard`](https://docs.devexpress.com/MAUI/DevExpress.Maui.DataForm.DataFormTextItemBase.Keyboard) property to define a type of keyboard used to input text.
95
76
96
77
## Files to Look At
97
78
98
79
<!-- default file list -->
99
-
* [MainPage.xaml](MainPage.xaml)
100
-
* [MainPage.xaml.cs](MainPage.xaml.cs)
101
-
* [MainViewModel.cs](MainViewModel.cs)
102
-
* [App.xaml](App.xaml)
80
+
* [MainPage.xaml](CS/MainPage.xaml)
81
+
* [MainPage.xaml.cs](CS/MainPage.xaml.cs)
82
+
* [MainViewModel.cs](CS/MainViewModel.cs)
83
+
* [App.xaml](CS/App.xaml)
103
84
<!-- default file list end -->
104
85
105
86
## Documentation
106
87
107
-
* [Featured Scenario: Context Menu Actions in Popup](https://docs.devexpress.com/MAUI/404342)
Copy file name to clipboardExpand all lines: README.md
+7-2
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,6 @@ See the following help topic for more information: [DevExpress Data Form for .NE
29
29
30
30
You can also refer to the following YouTube video for instructions on how to get started with the Data Form Control: [Adding a Data Form to Your .NET MAUI App](https://www.youtube.com/watch?v=imUCmru5Lwc&ab_channel=DevExpress).
31
31
32
-
33
32
### Customize the Data Form Appearance
34
33
35
34
The [CustomAppearance](./CS/CustomAppearance/) project shows how to customize the appearance of Data Form items.
@@ -40,7 +39,6 @@ The [CustomAppearance](./CS/CustomAppearance/) project shows how to customize th
40
39
41
40
The [AddingDataEditorsAtRuntime](./CS/AddingDataEditorsAtRuntime/) project shows how to add and remove Data Form items at runtime.
42
41
43
-
44
42
<imgsrc="./Images/data-form-runtime-iphone.png"alt="DevExpress Data Form for iOS"height="700"/> <imgsrc="./Images/data-form-runtime-android.png"alt="DevExpress Data Form for Android"height="700"/>
45
43
46
44
### Display ComboBox
@@ -49,6 +47,12 @@ The [ComboBoxEditor](./CS/ComboBoxEditor/) project shows how to display a Combob
49
47
50
48
<imgsrc="./Images/data-form-combobox-iphone.png"alt="DevExpress Data Form for iOS"height="700"/> <imgsrc="./Images/data-form-combobox-android.png"alt="DevExpress Data Form for Android"height="700"/>
51
49
50
+
### Upload and Edit Avatar
51
+
52
+
The [EditFormExample](./CS/EditFormExample/) project shows how to integrate the [ImageEdit](https://docs.devexpress.com/MAUI/DevExpress.Maui.Editors.ImageEdit) control within the Data Form to edit the avatar.
53
+
54
+
<imgsrc="./Images/data-form-with-image-edit-upload.png"alt="DevExpress Data Form for iOS"height="700"/> <imgsrc="./Images/data-form-with-image-edit-bs.png"alt="DevExpress Data Form for Android"height="700"/>
0 commit comments