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 

Replacement inside of a binding

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



Joined: 27 Aug 2012
Posts: 10

PostPosted: Tue Sep 25, 2012 2:27 pm    Post subject: Replacement inside of a binding Reply with quote

While I can manually use a ResX inside the textblock below, the auto scanner doesn't pick it up, even if I turn on StringFormat attributes as something to go after.

Is there any creative way to get the scanner to ResXify strings inside a binding as below?

<TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType=local:MainWindow}, Path=ConnectionRetryCount, StringFormat='Please wait while a connection to the server is re-established (attempt {0} of 10)...'}"
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Tue Sep 25, 2012 10:50 pm    Post subject: Reply with quote

The Globalizer scanner only converts simple properties to use the ResX extension. Even if it could convert the StringFormat property this only works if you don't try to change the culture dynamically - because Bindings don't allow the StringFormat property to change once it has been set. Instead you should change the XAML to use the Binding properties of the ResX extension eg

Code:
<TextBlock>
    <Resx Key="MyFormatString" BindingRelativeSource={RelativeSource AncestorType=local:MainWindow}, BindingPath=ConnectionRetryCount/>
</TextBlock>


Where MyFormatString is the key for a resource you added to the window resources file manually. Globalizer will automatically scan items that have been added to the resources file manually. See the section Formatting Bound Data in the code project
WPF Localization Using RESX Files article for more details.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
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