1. Binding Currency, if no characters, need to join behind = {} then go wrong without.
1
|
<TextBlock Text=
"{Binding Amount, StringFormat={}{0:C}}"
/>
|
2. Binding Currency, and add some character before. Compared with the above, there is no} {
1
|
<TextBlock Text=
"{Binding Amount, StringFormat=Total: {0:C}}"
/>
|
3. Binding Date
1
|
<TextBlock Text=
"{Binding Date, StringFormat={}{0:MM/dd/yyyy}}"
/>
|
4. Binding Time
1
|
<TextBlock Text=
"{Binding Date, StringFormat={}{0:MM/dd/yyyy hh:mm tt}}"
/>
|
5. Multiple Binding
1
2
3
4
5
6
|
<TextBlock.Text>
<MultiBinding StringFormat=
"Delete {0} {1}"
>
<Binding Path=
"FirstName"
/>
<Binding Path=
"LastName"
/>
</MultiBinding>
</TextBlock.Text>
|
6. Multiple bindings special characters, such as \ t
1
2
3
4
5
6
|
<TextBlock.Text>
<MultiBinding StringFormat=
"Delete {0}	{1}"
>
<Binding Path=
"FirstName"
/>
<Binding Path=
"LastName"
/>
</MultiBinding>
</TextBlock.Text>
|
Special characters are as follows:
- \a  BEL
- \b  BS - Backspace
- \f  FF - Formfeed
- \n 
 LF, NL - Linefeed, New Line
- \r 
 CR - Carriage return
- \t 	 HT - Tab, Horizontal Tabelator
- \v  VT - Vertical Tabelator
Transfer from: http: //blog.jinlook.com/post/2012/07/23/XAMLBindingStringFormat.aspx
Reproduced in: https: //my.oschina.net/garyun/blog/602721