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 

Use of the Resx extension in a Trigger

 
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 6:16 pm    Post subject: Use of the Resx extension in a Trigger Reply with quote

I've run into a scenario with the Resx markup extension similar to the binding problem. I want to be able to use it within a DataTrigger. The scenario is basically a Button element with a local style containing a number of triggers. The triggers are DataTriggers that set the text of the button based on some different properties.

Some of the triggers use an element binding to another control on the screen, some are bound to properties on the view model. Regardless, they each contain a Setter element to set the Text property value to the value of a {Resx} lookup.

Like a binding, this works great with the initial culture, but as soon as I change the culture at runtime it throws an exception "After a 'SetterBase' is in use (sealed), it cannot be modified." I assume this is a similar problem to the binding situation with the Resx extension. Is there a way to work around this problem similar to the <Resx> element for dealing with bindings?

Thanks,
Kevin
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

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

The way Style Setter properties are designed means that it is not possible to use Resx Extension with them and support dymanic language changing.

See the following thread on Code Project for more detail:

http://www.codeproject.com/Articles/35159/WPF-Localization-Using-RESX-Files?msg=4200417#xx4200417xx
_________________
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 3:33 pm    Post subject: Reply with quote

Okay, thanks, that's what I assumed but wanted to verify. I came up with an alternate solution that eliminates the triggers and replaces it with a <Resx> binding element to an enum property and takes advantage of the ResouceEnumConverter - another really cool feature!
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