locked
Can I access a string value from resource which is from another project in windows phone ?

    Question

  • I have a project which is having all resource.ascx for few launguages.

    In this project is having app.xaml as below,

     <local:LocalizedStrings xmlns:local="clr-namespace:SampleApp" x:Key="LocalizedStrings" />

    I used above string for a page, to bind the text for textblock using localization like,

    Text="{Binding Path=LocalizedResources.VerificationPage_sample, Source={StaticResource LocalizedStrings}}"/>

    But now I need to use same like above line in another page which is in another project, how can I use this ?

    Thanks in advance.


    Friday, January 02, 2015 10:26 AM

Answers

  • The resources in your App.xaml will be available to all pages that are used within this application, whether they are defined in the app project itself or in a referenced class library.

    This means that you can reference a resource that is defined in App.xaml in the app project as usual in the class library project:

    Source={StaticResource LocalizedStrings}

    Note that you will get a runtime error if you try to use the library in another app that doesn't have any "LocalizedStrings" resource defined in its App.xaml though. If you want to be able to use a resource across different applications, you should define the resources in a separate project, i.e. not directly in App.xaml, and reference this project from your apps and any class libraries that uses these resources.

    Please remember to mark helpful posts as answer and please start a new thread if you have a new question.

    Friday, January 02, 2015 1:15 PM