c# - Use Converter for static text In Windows Phone 8 -
c# - Use Converter for static text In Windows Phone 8 -
i want give text binding
parameter here code .. want utilize converter alter text language
<textblock text="{binding #mytext goes here#,converter={staticresource languageconverter}}" style="{staticresource tbinfo}" />
in above textblock want alter text using languageconverter
even can bind class property straight string or content
public string header_text = {get;set;} <textblock text="{binding header_text,converter={staticresource languageconverter}}" style="{staticresource tbinfo}" />
i add together static resource entry:
<usercontrol.resources> <sys:string x:key="headertext" xmlns:sys="clr-namespace:system;assembly=mscorlib">mytext goes here</sys:string> </usercontrol.resources> <textblock text="{binding source={staticresource headertext},converter={staticresource languageconverter}}" />
alternately, if wanted include text inline, pass using "converterparameter". work, you'd need modify converter class utilize "parameter" if set.
<textblock text="{binding converterparameter='mytext goes here',converter={staticresource languageconverter}}" />
also, think @stuartsmith right, ideally should consider using .net's globalization/localization framework. gives improve runtime performance (the localized dlls compiled satellite assemblies, reduces application's memory footprint).
c# windows-phone-8
Comments
Post a Comment