在 Windows Phone 7 上使用 StringFormat 绑定? [英] Binding with StringFormat on Windows Phone 7?

查看:32
本文介绍了在 Windows Phone 7 上使用 StringFormat 绑定?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一些 Windows Phone 7 开发并且想要格式化一个我绑定的字符串.

I'm doing some Windows Phone 7 development and want to format a string I've bound to.

出于某种原因,我无法使用如下所示的 StringFormat.该选项不存在.

For some reason I cannot use the StringFormat like shown below. The option just isn't there.

 <TextBlock Text="{Binding Distance, StringFormat=\{0\}km}" />

为什么 StringFormat 不适用于 Windows Phone 7?

Why isn't the StringFormat available for Windows Phone 7?

推荐答案

StringFormat 是在 7.1/Mango 中添加的,因为 Mango 使用的是 SL4.来自 Visual Studio 杂志:

StringFormat was added with 7.1 / Mango since Mango uses SL4. An example from Visual Studio Magazine:

<TextBlock Text="{Binding CurrentDate,StringFormat='dddd, d MMMM yyyy'}" />

这篇关于在 Windows Phone 7 上使用 StringFormat 绑定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆