Table of Contents

Class LocalizeEnumExtension

Namespace
RentADeveloper.ResXLocalization.Avalonia
Assembly
ResXLocalization.Avalonia.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
MarkupExtension
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

string

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

ResourceManager

Methods

ProvideValue(IServiceProvider)

Provides the value supplied to the target property: a 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

serviceProvider IServiceProvider

The service provider supplied by the XAML loader.

Returns

object

An Avalonia binding that yields the localized enumeration text, or Empty when the target is not an Avalonia.AvaloniaObject.