- 通貨のフォーマット
<TextBlock Text="{Binding Price, StringFormat={}{0:C}}" /> // $123.46
- 通貨形式、小数点1桁
<TextBox Text="{Binding Price, StringFormat={}{0:C1}}" /> // $123.5
- 前の言葉
<TextBox Text="{Binding Price, StringFormat=单价:{0:C}}" /> //单价:$123.46
- 後のテキスト
<TextBox Text="{Binding Price, StringFormat={}{0}元}" /> // 123.45678元
- 固定ビット数、フォーマットされていない前よりも少ないビット数、整数のみサポート
<TextBox Text="{Binding Count, StringFormat={}{0:D6}}" /> // 086723
- 小数点以下の桁数の指定
<TextBox Text="{Binding Total, StringFormat={}{0:F4}}" /> // 28768234.9329
- セミコロンで区切った数値で、小数点以下の桁数を指定します
<TextBox Text="{Binding Total, StringFormat={}{0:N3}}" /> // 28,768,234.933
- フォーマットの割合
<TextBox Text="{Binding Persent, StringFormat={}{0:P1}}" /> // 78.9 %
- プレースホルダー
<TextBox Text="{Binding Price, StringFormat={}{0:0000.00}}" /> // 0123.46
<TextBox Text="{Binding Price, StringFormat={}{0:####.##}}" /> // 123.46
- 日付/時間
<TextBox Text="{Binding DateTimeNow, StringFormat={}{0:d}}" /> // 5/4/2015
<TextBox Text="{Binding DateTimeNow, StringFormat={}{0:D}}" /> // Monday, May 04, 2015
<TextBox Text="{Binding DateTimeNow, StringFormat={}{0:f}}" /> // Monday, May 04, 2015 5:46 PM
<TextBox Text="{Binding DateTimeNow, StringFormat={}{0:F}}" /> // Monday, May 04, 2015 5:46:56 PM
<TextBox Text="{Binding DateTimeNow, StringFormat={}{0:g}}" /> // 5/4/2015 5:46 PM
<TextBox Text="{Binding DateTimeNow, StringFormat={}{0:G}}" /> // 5/4/2015 5:46:56 PM
<TextBox Text="{Binding DateTimeNow, StringFormat={}{0:m}}" /> // May 04
<TextBox Text="{Binding DateTimeNow, StringFormat={}{0:M}}" /> // May 04
<TextBox Text="{Binding DateTimeNow, StringFormat={}{0:t}}" /> // 5:46 PM
<TextBox Text="{Binding DateTimeNow, StringFormat={}{0:T}}" /> // 5:46:56 PM
<TextBox Text="{Binding DateTimeNow, StringFormat={}{0:yyyy年MM月dd日}}" /> // 2015年05月04日
<TextBox Text="{Binding DateTimeNow, StringFormat={}{0:yyyy-MM-dd}}" /> // 2015-05-04
<TextBox Text="{Binding DateTimeNow, StringFormat={}{0:yyyy-MM-dd HH:mm}}" /> // 2015-05-04 17:46
<TextBox Text="{Binding DateTimeNow, StringFormat={}{0:yyyy-MM-dd HH:mm:ss}}" /> // 2015-05-04 17:46:56
- 複数のバインディング
<TextBox.Text>
<MultiBinding StringFormat="姓名:{0}{1}">
<Binding Path="FristName" />
<Binding Path="LastName" />
</MultiBinding>
</TextBox.Text>
// 姓名:AAbb
- マルチバインディングの特殊文字
<TextBox.Text>
<MultiBinding StringFormat="姓名:{0}	{1}">
<Binding Path="FristName" />
<Binding Path="LastName" />
</MultiBinding>
</TextBox.Text>
<!--
\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
-->
オリジナルタイトル:The Search
原文へのリンク:https//www.cnblogs.com/ZXdeveloper/p/15513657.html