wpf - Label ContentStringFormat with new line -


i try add new line inside label contentstringformat:

content="{binding path=(my:mydata.files)}" contentstringformat="{}number of files:\n {0:#,0}" 

any suggestions ?

you can't use c# escape characters in xaml code. xaml there other possibilities:

  • hex represenation of cr/lf 
 (or line feed 
):

    contentstringformat="{}number of files: 
 {0:#,0}"

  • bind string contains new line charachters need them

  • use multibinding environment.newline

    <multibinding stringformat="{}{0}{2}{1}" mode="oneway">     <binding path="property0" />     <binding path="property1" />     <binding source="{x:static system:environment.newline}"/> </multibinding> 

Comments