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

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -