Skip to main content
Home Forums Silverlight Programming Programming with .NET - General Resource file from other project
2 replies. Latest Post by cybercandyman on July 2, 2009.
(0)
cybercan...
Member
0 points
8 Posts
06-30-2009 6:59 AM |
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));
nirav_20...
274 points
105 Posts
07-02-2009 3:21 AM |
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
07-02-2009 4:44 AM |
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"));