EnumFieldValueProperty
If the type for EnumField is not specified in UIBuilder (or .uxml), you need to call EnumField.Init()
.EnumFieldValueProperty
is a BindableProperty
that executes EnumField.Init()
during data binding.
How to Declare
As with BindableProperty
, you can declare by calling EnumFieldValueProperty.Create()
.
csharp
private static readonly EnumFieldValueProperty EnumFieldValueProperty =
EnumFieldValueProperty.Create(
defaultValue: ControlShowCaseModel.SampleEnum.Midori,
dataSourcePath: PropertyPath.FromName(nameof(ControlsShowcaseViewModel.EnumFieldValue)),
elementNameInfo: ElementNames.EnumField,
BindingMode.TwoWay
);
Parameters
In addition to the parameters provided by BindableProperty, you can specify the following parameters:
Parameter | Type | Required | Default Value |
---|---|---|---|
defaultValue | enum | yes | - |
includeObsoleteValues | bool | no | false |
defaultValue
The initial value used inEnumField.Init()
. The type of Enum to be bound is determined from this value.
For more details on the internal implementation, see here.includeObsoleteValues
Specifies whether to display enum values marked with[Obsolete]
.