WPF在XAML中Binding使用StringFormat属性
来源:互联网 发布:pcb原理图设计软件 编辑:程序博客网 时间:2024/05/21 17:27
1、绑定Currency,如果没有字符的话,后面需要先加入{},不加的话会出问题
特殊字符如下:
\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
<TextBlock Text="{Binding Amount, StringFormat={}{0:C}}" />2、绑定Currency,并在前面加入一些字符,跟上面相比,没有{}
<TextBlock Text="{Binding Amount, StringFormat=Total: {0:C}}" />3、绑定日期
<TextBlock Text="{Binding Date, StringFormat={}{0:MM/dd/yyyy}}" />4、绑定时间
<TextBlock Text="{Binding Date, StringFormat={}{0:MM/dd/yyyy hh:mm tt}}" />5、多重绑定
<TextBlock.Text> <MultiBinding StringFormat="Delete {0} {1}"> <Binding Path="FirstName" /> <Binding Path="LastName" /> </MultiBinding> </TextBlock.Text>6、多重绑定中的特殊字符,如 \t
<TextBlock.Text> <MultiBinding StringFormat="Delete {0}	{1}"> <Binding Path="FirstName" /> <Binding Path="LastName" /> </MultiBinding> </TextBlock.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
转载自:http://blog.jinlook.com/post/2012/07/23/XAMLBindingStringFormat.aspx
0 0
- WPF在XAML中Binding使用StringFormat属性
- Silverlight 4 Binding and StringFormat in XAML
- wpf 中使用StringFormat的技巧
- wpf 中使用StringFormat的技巧
- 在数据绑定中使用StringFormat
- WPF中StringFormat的用法
- WPF中StringFormat的用法
- WPF 在代码中Binding
- wpf中的 绑定Binding MultiBinding StringFormat格式转化问题
- WPF (xaml) 属性
- wpf StringFormat
- WPF中如何在Xaml里通过Trigger修改该其他控件的属性
- WPF中如何在Xaml里通过Trigger修改该其他控件的属性
- WPF实例秀——不用属性也Binding(XAML篇)
- WPF中,使用快捷键格式化XAML代码
- WPF中StringFormat 格式化 的用法
- WPF中StringFormat的用法 (转)
- WPF 中使用XML作为Binding数据源
- hdu2113 Secret Number
- 2-3文件+结构体实现实用系统
- [Blog Read] Android 事件分发
- 基于lucene创建实时索引基础jar包
- 背景建模
- WPF在XAML中Binding使用StringFormat属性
- leetcode Length of Last Word java实现
- jQuery 获取跨域XML(RSS)数据相关总结
- Linux-Shell之前基础
- MyEclipse中如何设置 jdk 和 jre 编译运行环境
- OBIEE访问hive数据环境搭建
- 个人应用调用Android系统闹钟
- UML类图符号 类和对象的各种关系说明
- iOS7设置状态栏背景颜色