OT: Using resx files in WpfOT: Using resx files in Wpf
Old forum URL: forums.lhotka.net/forums/t/4778.aspx
ajj3085 posted on Wednesday, April 30, 2008
Hi,
In my WinForms application, I have the Resouces.resx and code behind file to hold localized strings and images. Although I don't localize, I found it useful to store string and image data in a single place in the apllication. WinForms allows me to use the designer to set that a toolbar button's image will come from this file.
I'd like to do the same in Wpf. There doesn't seem to be designer support, but I'm hoping there's still some way to do this. Or are things changing in Wpf and resource files?
Thanks
Andy
ajj3085 replied on Thursday, May 01, 2008
Hm.. I tried the suggestion, but it doesn't seem to work for me. Maybe because my resource file is in the same assembly as the wpf window?
I'll have to find something else..
thanks
andy
ajj3085 replied on Thursday, May 01, 2008
Ok, so it seems I don't need to put anything in the Properties\Resources.resx file.
I have a Resources folder (just like in WinForms, because Resources.resx would do file links to the file in the Resources folder). The file was already set to BuildAction Resource. In Xaml, I can do this:
<Image Source="/Resources/Save16.png" />
and it just works. Of course now I'm wondering if my resources in WinForms are double embedded; once in the embedded resource file and seperately.
andy
Copyright (c) Marimer LLC