Class LocalizeEnumExtension
- Namespace
- RentADeveloper.ResXLocalization.WPF
- Assembly
- ResXLocalization.WPF.dll
XAML markup extension that localizes the enumeration value held in the target control's
DataContext, re-resolving live on every culture change. Intended for item templates where
each item is an enumeration value, for example
<TextBlock Text="{l:LocalizeEnum}" />. The value is mapped to a resource key using the
convention {KeyPrefix}{EnumTypeName}_{Value}.
public sealed class LocalizeEnumExtension : MarkupExtension
- Inheritance
-
LocalizeEnumExtension
- Inherited Members
Properties
KeyPrefix
Gets or sets the prefix prepended to the generated resource key. Defaults to Enum_.
public string KeyPrefix { get; set; }
Property Value
ResourceManager
Gets or sets the resource manager that scopes the lookup to a single .resx file. When
unset, the generated key is searched across all registered resource managers.
public ResourceManager? ResourceManager { get; set; }
Property Value
Methods
ProvideValue(IServiceProvider)
Provides the value supplied to the target property: a multi-binding that yields the localized
text for the control's current DataContext enumeration value, updated live on every
culture change.
public override object ProvideValue(IServiceProvider serviceProvider)
Parameters
serviceProviderIServiceProviderThe service provider supplied by the XAML loader.
Returns
- object
A WPF multi-binding that yields the localized enumeration text.