|
-
Jul 1st, 2009, 10:27 AM
#1
Thread Starter
Frenzied Member
Re: You owe it to yourself to use WPF
Ha ha yeah where on the same timezone but unfortunately commission means that I take lunch when its quiet not when im hungry.
So I noticed that in your post jenner you talk about messing with forms for localization. Here is how I would do it. First great a generic xaml based window for English. Be careful when creating a window that it conforms to good web standards so that controls grow or shrink as text changes rather than having to do it manually.
Then I would simply have different resource dictionaries for each language. I don't have it to hand but there is generic .net code to find out the localization of the computer your application is running on. Using this you can simply load the applicable resource file.
Now I know you can just let windows handle the text, infact WPF does it very well, but you would be best to still double check the text for obvious language conversion reasons.
As for embedding resources. I never really understood the actual need for it. The image can be accessed so long as it is in a folder. So in essence rather than having an .RESX file for each language you would have a .Xaml file and you would have a small helper class which loads up the correct one.
In fact you could go one step further and parse the whole UI based on language because you can add a Xaml parser with your app but that would be just showing off.
-
Jul 1st, 2009, 10:37 AM
#2
Re: You owe it to yourself to use WPF
 Originally Posted by DeanMc
In fact you could go one step further and parse the whole UI based on language because you can add a Xaml parser with your app but that would be just showing off.
and would probably be a bit slow 
As for using a helper class to work with the images, I believe in WPF the best way might be to use a Converter (this might be what you are referring to, just with a different name). I've not done a lot with them yet (will be doing very soon though) but I believe you can use Converters to basically apply some logic which you have defined in your VB code behind and set a specific XAML property based on that logic.
For example, this application uses a converter to convert the DateTime value stored with each item in the listbox into a representation of that time in a clock image: http://learnwpf.com/Data/Images/Lear...taTemplate.jpg
So in a similar way, you could use a converter to check which language you are currently using and that then dictates which image gets shown.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|