Class DesignTime

Namespace
RentADeveloper.ResXLocalization.Avalonia
Assembly
ResXLocalization.Avalonia.dll

Hosts the DesignTime.Culture attached property, which selects the language the Avalonia XAML previewer shows. Set it on the root element: <Window ... l:DesignTime.Culture="de">.

public sealed class DesignTime : AvaloniaObject, INotifyPropertyChanged
Inheritance
AvaloniaObject
DesignTime
Implements
Inherited Members
AvaloniaObject.CheckAccess()
AvaloniaObject.VerifyAccess()
AvaloniaObject.ClearValue(AvaloniaProperty)
AvaloniaObject.ClearValue<T>(AvaloniaProperty<T>)
AvaloniaObject.ClearValue<T>(StyledProperty<T>)
AvaloniaObject.ClearValue<T>(DirectPropertyBase<T>)
AvaloniaObject.GetHashCode()
AvaloniaObject.GetValue(AvaloniaProperty)
AvaloniaObject.GetValue<T>(StyledProperty<T>)
AvaloniaObject.GetValue<T>(DirectPropertyBase<T>)
AvaloniaObject.GetBaseValue<T>(StyledProperty<T>)
AvaloniaObject.IsAnimating(AvaloniaProperty)
AvaloniaObject.IsSet(AvaloniaProperty)
AvaloniaObject.SetValue<T>(StyledProperty<T>, T, BindingPriority)
AvaloniaObject.SetValue<T>(DirectPropertyBase<T>, T)
AvaloniaObject.SetCurrentValue<T>(StyledProperty<T>, T)
AvaloniaObject.Bind(AvaloniaProperty, BindingBase)
AvaloniaObject.CoerceValue(AvaloniaProperty)
AvaloniaObject.this[AvaloniaProperty]
AvaloniaObject.this[IndexerDescriptor]
AvaloniaObject.Dispatcher
AvaloniaObject.PropertyChanged

Remarks

The property is for design time only and has no effect at run time. Inside the previewer it assigns CurrentCulture of the process-wide Current, so strings that view models look up in code agree with the XAML. It overrides a culture selected by initialization that the previewer executes, such as a culture assigned in BuildAvaloniaApp.

Without it, the previewer uses the machine's UI culture, unless initialization that the previewer executes selects another culture.

An empty name and a name that CultureInfo rejects, such as a half-typed one, leave the culture unchanged.

Fields

CultureProperty

Identifies the DesignTime.Culture attached property: the name of the culture the previewer shows, such as de.

public static readonly AttachedProperty<string?> CultureProperty

Field Value

AttachedProperty<string>

Methods

GetCulture(AvaloniaObject)

Gets the culture name set on element for the previewer.

public static string? GetCulture(AvaloniaObject element)

Parameters

element AvaloniaObject

The element to read the value from.

Returns

string

The culture name, or null if none is set.

SetCulture(AvaloniaObject, string?)

Sets the culture name the previewer shows. Inside the previewer this assigns CurrentCulture of Current; at run time it only stores the value.

public static void SetCulture(AvaloniaObject element, string? value)

Parameters

element AvaloniaObject

The element to set the value on, usually the root element of the view.

value string

The culture name, such as de.