.NET MAUI DataForm Error Message Styling
The DatePicker control for .NET MAUI provides styling options for customizing the appearance of the error message that appears when the entered data is invalid.
The style of the error message can be set individually for each editor or directly to the DataForm control using the following styling properties:
-
ErrorImageSource
(ImageSource
)—Specifies theImageSource
of the image displayed in the error message. -
ErrorImageStyle
(of typeStyle
with target typeImage
)—Defines the error image style. -
ErrorLabelStyle
(of typeStyle
with target typeLabel
)—Defines the error label style.
1. Defining two different ErrorLabelStyle
:
2. Apply common ErrorLabelStyle
for all editors:
Note that local
in the snippet above points to the namespace where the DataTypeEditorsModel
is defined.
3. Apply ErrorLabelStyle
per editor:
Note that local
in the snippet above points to the namespace where the DataTypeEditorsModel
is defined.
4. Add the following namespace:
5. The ViewModel
used for the DataForm editors
The following image shows what the DataForm control looks like when the styles described above are applied:
For a runnable example with the DataForm Error Message Styling scenario, see the SDKBrowser Demo Application and go to DataForm > Styling category.