Skip to content

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:

ParameterTypeRequiredDefault Value
defaultValueenumyes-
includeObsoleteValuesboolnofalse
  • defaultValue
    The initial value used in EnumField.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].