MultiBinding的StringFormat参数问题
在wpf的绑定中,我们会用到多值绑定,如下:
<MultiBinding Mode="OneWay" StringFormat="{3}({0}/{1}):{2}">
<Binding Path="CurIndex" Mode="OneWay"></Binding>
<Binding Path="TotalCount" Mode="OneWay"></Binding>
<Binding Path="CurName" Mode="OneWay"></Binding>
<Binding Path="AreaName" Mode="OneWay"></Binding>
</MultiBinding>
这里如果
StringFormat="{3}({0}/{1}):{2}"这样写是不能通过编译器的,解决方案是在前面加一组大括号就可以了,如下:
StringFormat="{}{3}({0}/{1}):{2}"
完整绑定如下:
<TextBlock.Text>
<MultiBinding Mode="OneWay" StringFormat="{}{3}({0}/{1}):{2}">
<Binding Path="CurIndex" Mode="OneWay"></Binding>
<Binding Path="TotalCount" Mode="OneWay"></Binding>
<Binding Path="CurName" Mode="OneWay"></Binding>
<Binding Path="AreaName" Mode="OneWay"></Binding>
</MultiBinding>
</TextBlock.Text>
MultiBinding的StringFormat参数问题的更多相关文章
- WPF在XAML中使用MultiBinding的两个例子
使用MultiBinding的原则:数据源有一个以上: 1. 需求:在一个需要显示的内容中,不同的部分要进行的处理不一样,这时可以使用MultiBinding <TextBlock> &l ...
- Wpf 数据绑定之BindingBase.StringFormat
BindingBase.StringFormat 属性获取或设置一个字符串,该字符串指定如果绑定值显示为字符串,应如何设置该绑定的格式. StringFormat 可以是预定义的.撰写的或自定义的字符 ...
- WPF XAML之bing使用StringFormat(转)
释义 BindingBase.StringFormat 属性 获取或设置一个字符串,该字符串指定如果绑定值显示为字符串,应如何设置该绑定的格式. 命名空间: System.Windows ...
- django 过滤器、日日期格式化参数
转载:http://blog.csdn.net/xyp84/article/details/7945094 django1.4 html页面从数据库中读出DateTimeField字段时,显示的时间格 ...
- django 过滤器 、日期格式化参数
http://blog.csdn.net/xyp84/article/details/7945094 django1.4 html页面从数据库中读出DateTimeField字段时,显示的时间格式和数 ...
- WPF在XAML中Binding使用StringFormat属性
1. 绑定Currency, 如果没有字符的话, =后面需要先加入{}. 不加的话会出问题. 1 <TextBlock Text="{Binding Amount, StringFor ...
- StringBuild,StringFormat," "+" " 三种方法速度测试
测试方式: Stopwatch sw = new Stopwatch(); sw.Start(); string tmp = ""; StringBuilder sb = new ...
- 【转载】django 过滤器 、日期格式化参数
过滤器相关: 一.形式:小写{{ name | lower }} 二.串联:先转义文本到HTML,再转换每行到 标签{{ my_text|escape|linebreaks }} 三.过滤器的参数显示 ...
- WPF StringFormat 格式化文本
StringFormat对特定数据格式的转换 WPF中,对数字/日期等的格式化,可参考此篇博客:https://www.cnblogs.com/zhengwen/archive/2010/06/19/ ...
随机推荐
- CI学习总结
1.CI自定义配置文件: 如:config/test.php <?php $config['test']['good'] = array('aa','bb'); 在控制器中这样调用: <? ...
- UITextView的一些技巧
1.在指定位置插入字符串: NSMutableString *TextViewStr=[[NSMutableString alloc] initWithString:TextView.text ...
- Vue中表单校验
1.安装校验插件vee-validate npm install vee-validate --save 2.在main.js中引用插件 // 表单校验 import VeeValidate, { V ...
- Vue中div高度自适应
Vue中尽量不使用dom的高度计算 <template> <div :style="conheight"> </template> <sc ...
- SQL Server里的 ISNULL 与 NULLIF(转)
SQL Server 中有两个参数,语法: ISNULL(check_expression, replacement_value) check_expression 与 replacement ...
- okhttp 请求list数据实例
public class DataBean { /** * id : 61684 * movieName : <猜火车2>先导预告片 * coverImg : http://img31.m ...
- Swift 烧脑体操(三) - 高阶函数
前言 Swift 其实比 Objective-C 复杂很多,相对于出生于上世纪 80 年代的 Objective-C 来说,Swift 融入了大量新特性.这也使得我们学习掌握这门语言变得相对来说更加困 ...
- 更新TP-LINK路由器的外网IP到花生壳动态IP解析
------------------------------------------------------------------------------- 以下内容可能还是存在问题,等之后有时间再 ...
- Spring Boot 生成接口文档 swagger2
swagger,中文“拽”的意思.它是一个功能强大的api框架,它的集成非常简单,不仅提供了在线文档的查阅,而且还提供了在线文档的测试. 另外swagger很容易构建restful风格的api,简单优 ...
- P3968 [TJOI2014]电源插排
P3968 [TJOI2014]电源插排 线段树维护最长空区间及左端点位置,这个和$nlongn$的动态最大子序和差不多,就不多解释了 $n$较大哈希优化空间 My complete code: #i ...