EnumValuesExtension Class

XAML markup extension that provides all values of an enum type.

public sealed class EnumValuesExtension : MarkupExtension

Example

<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:wpf="clr-namespace:Meziantou.Framework.WPF;assembly=Meziantou.Framework.WPF"
             xmlns:local="clr-namespace:Meziantou.Framework.WPF.EnumComboBox">
    <ComboBox ItemsSource="{wpf:EnumValues {x:Type local:Week}}" />
</UserControl>
Inheritance
MarkupExtension EnumValuesExtension

Constructors

NameDescription
EnumValuesExtension()Initializes a new instance of the EnumValuesExtension class.
EnumValuesExtension(Type)Initializes a new instance of the EnumValuesExtension class with the specified enum type.

EnumValuesExtension overloads

EnumValuesExtension()

EnumValuesExtension.cs

Initializes a new instance of the EnumValuesExtension class.

public EnumValuesExtension()

EnumValuesExtension(Type)

EnumValuesExtension.cs

Initializes a new instance of the EnumValuesExtension class with the specified enum type.

public EnumValuesExtension(Type enumType)
Parameters
enumType Type
The enum type.

Properties

NameDescription
EnumTypeGets or sets the enum type to get values from.

Gets or sets the enum type to get values from.

public Type? EnumType { get; set; }

Property value

Type?

Methods

NameDescription
ProvideValue(IServiceProvider)Returns the enum values.

ProvideValue(IServiceProvider)

EnumValuesExtension.cs

Returns the enum values.

public override object ProvideValue(IServiceProvider serviceProvider)

Parameters

serviceProvider IServiceProvider

Returns

object