Class DesignTime

Namespace
RentADeveloper.ResXLocalization.WPF
Assembly
ResXLocalization.WPF.dll

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

public static class DesignTime
Inheritance
DesignTime
Inherited Members

Remarks

The property is for design time only and has no effect at run time. Inside the Visual Studio WPF designer or Rider's WPF 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 designer executes, such as a [ModuleInitializer] that selects English.

Without it, the designer uses the machine's UI culture, unless initialization that the designer executes selects another culture. The designer does not call Application.OnStartup, so a culture selected there does not apply at design time.

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 a XAML designer previews, such as de.

public static readonly DependencyProperty CultureProperty

Field Value

DependencyProperty

Methods

GetCulture(DependencyObject)

Gets the culture name set on element for the XAML designer.

public static string? GetCulture(DependencyObject element)

Parameters

element DependencyObject

The element to read the value from.

Returns

string

The culture name, or null if none is set.

SetCulture(DependencyObject, string?)

Sets the culture name a XAML designer previews. Inside a designer this assigns CurrentCulture of Current; at run time it only stores the value.

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

Parameters

element DependencyObject

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

value string

The culture name, such as de.