View previous topic :: View next topic |
Author |
Message |
kevinkuebler
Joined: 19 Jan 2015 Posts: 20 Location: United States
|
Posted: Mon Jan 19, 2015 5:14 pm Post subject: Using external resource files |
|
|
Hi,
I'm evaluating the use of Globalizer and the Resx extension in our WPF application. I know that the recommendation is to have one resx file per window/user control, and I have read the thread here regarding the use of common resource files.
However, there are reasons I would like to explore the use of shared resource files. And even going a step further, I would like to put them in a separate project/assembly from the main UI project. I've done this before with success when using the standard {x:Static loc:MyResources.MyKey} technique in XAML, where "loc" is an xmlns which references the namespace in the assembly containing the resources.
Is it possible to do this same sort of thing using the Resx extension? So far I have not been able to find a way to make it work, neither by using the DefaultResxName property at the window level, nor by adding ResxName directly to the controls using the Resx extension.
Thanks,
Kevin Kuebler |
|
Back to top |
|
|
kevinkuebler
Joined: 19 Jan 2015 Posts: 20 Location: United States
|
Posted: Mon Jan 19, 2015 8:20 pm Post subject: |
|
|
I figured it out by looking at the source. The markup extension searches through the assemblies returned from: Code: | AppDomain.CurrentDomain.GetAssemblies() | However, the assembly containing my resources wasn't in that list, even though I reference it from the UI project. By simply accessing one of the resource properties in that assembly in my app's startup code, it forces the assembly to be loaded into the AppDomain before the first usage of the extension, and then it works. |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Mon Jan 19, 2015 9:47 pm Post subject: |
|
|
Great - thanks for letting us know you found a solution. _________________ Infralution Support |
|
Back to top |
|
|
|