locked
how to use : ResourceLoader rl = ResourceLoader.GetForCurrentView("Resources");

    Question

  • unable to pull value from resource.resx field. Need help

    I can't get this to work:

              

    ResourceLoaderrl = ResourceLoader.GetForCurrentView("Resources");

     

    txtBlock1.Text = rl.GetString(

    "LongText");

             

    Thank you.

    Friday, February 6, 2015 2:28 PM

Answers

  • Thank you for the answer. I had actually found the answer on the MVA course

    "Developing Universal Windows Apps with C# and XAML"

      The problem was with the naming of the string in the resource.resw file. Instead of naming it string.text. I have to use string-text.  Using a hyphen over a dot made all the difference.         
    Tuesday, February 10, 2015 4:37 AM

All replies

  • Hi,

    Would you create a windows 8 store app or windows 8.1?

    I test the code in windows 8.1, everything is OK:

      ResourceLoader rl = ResourceLoader.GetForCurrentView("Resources");
                string test = rl.GetString("String1");

    I can get the string value.

    You can see Application resources and localization sample to get more information.

    If you create windows 8 app, you should edit your code below:

    ResourceLoader rl = new ResourceLoader("Resources");
    string localizedString = rl.GetString("String1");

    Best Wishes!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.

    Sunday, February 8, 2015 2:47 AM
  • Thank you for the answer. I had actually found the answer on the MVA course

    "Developing Universal Windows Apps with C# and XAML"

      The problem was with the naming of the string in the resource.resw file. Instead of naming it string.text. I have to use string-text.  Using a hyphen over a dot made all the difference.         
    Tuesday, February 10, 2015 4:37 AM