I have a function which, given a string, returns the string translated to German, linked to the xaml I want to edit:
public string convert (string label) {
return Translator.translate (label);
}
This string is then used to label some parts of my interface with TextBlocks in Silverlight. This is one sample TextBlock of my code:
<TextBlock Text="Center" Grid.Column="0" Grid.Row="0" HorizontalAlignment="Right" />
I would wish to modify the "Text" property to call convert passing the text "Center" as a parameter and show the return result as the Text. Is there any way to do that?
Greetings
You can make it a converter and apply it to the binding base in your TextBlock
kind of like;
<TextBlock Text="{Binding Text,
Converter={StaticResource YourTranslatorConverterThingy}}"/>
Here's just one article with a bit more explanation. Hope this helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.