I followed this tutorial to localize my app: http://msdn.microsoft.com/en-us/library/ff637520%28v=vs.92%29.aspx#Y1210
So I created the class:
namespace Foo
{
public class LocalizedStrings
{
public LocalizedStrings()
{
}
private static Foo.AppResources localizedresources = new Foo.AppResources();
public Foo.AppResources Localizedresources { get { return localizedresources; } }
}
}
When I use {Binding Path=Localizedresources.String1, Source={StaticResource LocalizedStrings}}
in the XAML files it works great, but
how can I access to the String1 in the source code e.g. to set a textBlock.Text
In C# you can just do:
textBlock.Text = AppResources.MyLocalizedString;
or in XAML:
<TextBlock Text="{Binding Path=LocalizedResources.MyLocalizedString, Source={StaticResource LocalizedStrings}}" >
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With