LocalizedEnumValuesExtension Class
XAML markup extension that provides localized enum values with display names from DisplayAttribute.
public sealed class LocalizedEnumValuesExtension : MarkupExtensionExample
<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">
<!-- Displays the names from the [Display] attributes of the enum members -->
<ComboBox ItemsSource="{wpf:LocalizedEnumValues {x:Type local:Week}}" DisplayMemberPath="Name" SelectedValuePath="Value" />
</UserControl>- Inheritance
MarkupExtensionLocalizedEnumValuesExtension
Constructors
| Name | Description |
|---|---|
| LocalizedEnumValuesExtension() | Initializes a new instance of the LocalizedEnumValuesExtension class. |
| LocalizedEnumValuesExtension(Type) | Initializes a new instance of the LocalizedEnumValuesExtension class with the specified enum type. |
LocalizedEnumValuesExtension overloads
LocalizedEnumValuesExtension()
LocalizedEnumValuesExtension.csInitializes a new instance of the LocalizedEnumValuesExtension class.
public LocalizedEnumValuesExtension()LocalizedEnumValuesExtension(Type)
LocalizedEnumValuesExtension.csInitializes a new instance of the LocalizedEnumValuesExtension class with the specified enum type.
public LocalizedEnumValuesExtension(Type enumType)Parameters
enumTypeType- The enum type.
Properties
| Name | Description |
|---|---|
| EnumType | Gets or sets the enum type to get localized values from. |
EnumType
LocalizedEnumValuesExtension.csMethods
| Name | Description |
|---|---|
| ProvideValue(IServiceProvider) | Returns the localized enum values. |
ProvideValue(IServiceProvider)
LocalizedEnumValuesExtension.csReturns the localized enum values.
public override object ProvideValue(IServiceProvider serviceProvider)