xaml - How to format WPF StaticResource extension markup string value -


the following code example contains usage of wpf staticresource string value:

<system:string x:key="sensor">sensor</system:string> ... <textblock text="{staticresource sensor}" textalignment="center"/> 

what need insert + char before "sensor" string. (for example: + senser)

it important note usage of textalignment="center" necessary me replacing textblcok label uses horizontalcontentalignmet="center" not option, because text more 1 line.

thanks.

you can use stringformat property.

<textblock text="{binding source={staticresource sensor},                           stringformat={}+{0}}" textalignment="center"/> 

Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -