Silverlight MVVM: How to do localization correctly?

In regular Silverlight projects, localization in the xaml view is done using:

Text="{BindingPath=ApplicationStrings.MyNewString, Source={StaticResource ResourceWrapper}}"

My question is: how to make the correct localization from labels when using the MVVM template?

Is this done as described here ?

In xaml view :

Text="{Binding LblUsername,FallbackValue='User Name'}"

And the LoginViewModel.cs class :

public string LblUsername
{
    get { return Resources.Username; }
}

Any tips here?


What about reusing the same line in multiple view / view modes? (Imagine I need a "Username" for multiple views.) Does it make sense to output all viewmodels from a basemodel that defines all resources?

+3
2

,

ApplicationStrings.MyNewString, Source={StaticResource ResourceWrapper}}

. , . , . "" .

, , , , .. . , . : -)

0

Source: https://habr.com/ru/post/1756195/


All Articles