Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bind resource file value strings in Windows Store App using C# and XAML

I have the resource file: Strings\en-US\Resources.resw

I'm trying to bind to a string from this file like so:

<TextBlock Text="{Binding Path=LocalizedResources.app_name, Source={StaticResource LocalizedStrings}}" />

I guess this approach is wrong because I get "The Resource 'TestString' could not be resolved.".

How do I bind to a string from a resource file?


PS: I have TestString in the resource file.

PPS: I need to create Windows 8 store app with Studio 2012, not Windows 8.1 app.

like image 918
Mit_ Avatar asked Dec 03 '25 08:12

Mit_


1 Answers

You can use same file from the Windows Phone project, but at first, you should move the localization to the PCL - Portable Class Library. You'll use localization in the same way as in Windows Phone in this case. Please, read this tutorial - it's not hard at all.

like image 92
crea7or Avatar answered Dec 05 '25 22:12

crea7or



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!