Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to use ConverterParameter with Resx resource

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Globalizer Support
View previous topic :: View next topic  
Author Message
kevinkuebler



Joined: 19 Jan 2015
Posts: 20
Location: United States

PostPosted: Fri Oct 30, 2015 2:31 pm    Post subject: How to use ConverterParameter with Resx resource Reply with quote

Hi,

Just bought the license for Globalizer Pro and installed the latest version (3.8.1). I've begun converting my application (WPF, .Net 4.5.1) to use the Resx markup extension in the XAML.

I also implemented a simple language switching menu, similar to what you have in your sample project to switch the language at runtime. Awesome feature! But on one screen I ran into an exception when I would do that, and after going back and reading the help on the Resx extension I realized it was due to trying to use it within a Binding. (The initial load of the screen worked fine, only got the exception when changing the language).

The trick is that the binding uses a converter and the converter takes a parameter which ends up getting used as a format string inside the Convert method. So I want the ConverterParameter to be provided by the Resx. Is this possible? I'm having trouble getting it to work based on the example provided for using the <Resx> element for a binding.

Side note: I noticed that the product version shown in the file details on the Infralution.Localization.WPF assembly says 3.2.1, not 3.8.1. Is that expected or do I have the wrong version somehow?

Thanks!
Kevin
Back to top
View user's profile Send private message
kevinkuebler



Joined: 19 Jan 2015
Posts: 20
Location: United States

PostPosted: Fri Oct 30, 2015 6:00 pm    Post subject: Reply with quote

I ended up changing this to get rid of the converter and just use the Key property of the <Resx> element to act as the string format, the way it's shown in the sample. I would still be interested in knowing if it's possible to use a resource as the converter parameter in case there's another scenario where a converter needs some text for a reason other than a format string.
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 4972

PostPosted: Sun Nov 01, 2015 11:04 pm    Post subject: Reply with quote

You have the right version of the Infralution.Localization.WPF assembly - its just that we don't update the version of that assembly (unless something in it has changed) to avoid breaking customers code that depends on the assembly unnecessarily.

If you want to use dynamic language switching then this can introduce some limitations - especially relating to DataBindings. See the following thread on Code Project:

http://www.codeproject.com/Articles/35159/WPF-Localization-Using-RESX-Files?msg=4191050#xx4191050xx
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
kevinkuebler



Joined: 19 Jan 2015
Posts: 20
Location: United States

PostPosted: Mon Nov 02, 2015 2:23 pm    Post subject: Reply with quote

Okay, thanks. Yeah I read the article, since it's the only documentation on that feature. Smile Anyway, I just wanted to confirm that there was no way to use the Resx element in the manner I was trying to do. I worked around it by changing my code in this case and will keep that limitation in mind for the future. Thanks!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Globalizer Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group