Skip to main content

Microsoft Silverlight

Answered Question Resource file from other projectRSS Feed

(0)

cybercandyman
cybercan...

Member

Member

0 points

8 Posts

Resource file from other project

Hello,

I have a silverlight application composed with several project in csharp.

In the main project I have a ressource file named : Resource.resx. I've made a reference in xaml with 

 

    <Application.Resources>
<local:Resource x:Key="LanguageRessource"/>
</Application.Resources>

In other project i have access to this ressource when i bind in XAML like :

 

<TextBlock Text="{Binding Path=LinkHTML, Source={StaticResource LanguageRessource}}"  Width="80" Foreground="#FFB5B5B5"/>
 

It works !!!

But I'm looking to get some value from this resource from the code behind in other project without success :(

How to do this ?

i am currently trying with something around this, but it does not work :

 

m_messageBoxDialog.ShowAsModal(reader.GetString("AboutCurrentProgram",Application.Current.Resources));
 
Thanks !!!!

nirav_2052003
nirav_20...

Member

Member

274 points

105 Posts

Re: Resource file from other project

If I understand your requirement correctly, you have two silverlight projects. One contains resource.resx file. You want to use one of the key value of this resource file in the other silverlight project.

If this is the case, it is not possible, because the resource file will be part of the application xap file which will get loaded to client side. If you want to access the same resource file in second silverlight application you have to load the entire xap file of first silverlight application and get the resource file from that same in second silverlight application.

I suggest this is not the good way. Better to have separate resource files in both the silverlight applications.

 

Regards,

Nirav

cybercandyman
cybercan...

Member

Member

0 points

8 Posts

Answered Question

Re: Re: Resource file from other project

thank you for your answer.

My resource file is loaded by the main project into the global application, so I have solved my problem with :

System.Resources.ResourceManager reader = new ResourceManager("xxx.Player.Resource", Application.Current.GetType().Assembly);

m_messageBoxDialog.ShowAsModal(reader.GetString("MsgBoxCheckField"));

 

 

 

 

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities