WPF StringFormat={}{0:N} 错误“预期“”

发布于 2024-09-05 01:05:54 字数 159 浏览 1 评论 0原文

我在使用 stringformat 绑定的 VS 2008 SP1 和 WPF 中遇到错误,vs 2008 中的 wpf 是否存在固有问题?

预期错误 1 ​​'ConstituentCrossrateGridControl.xaml 70 141 PriceViewWpfLibrary

I'm getting an error in VS 2008 SP1 with WPF using the stringformat binding, is there an inherent problem with wpf in vs 2008?

Error 1 Expected ' ConstituentCrossrateGridControl.xaml 70 141 PriceViewWpfLibrary

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

赏烟花じ飞满天 2024-09-12 01:05:54

正如错误消息所示,请尝试将 StringFormat 值用单引号引起来。例如:

<TextBlock Text="{Binding StringFormat='{}{0:N}'}" />

As the error message suggests, try wrapping your StringFormat value in single quotes. For example:

<TextBlock Text="{Binding StringFormat='{}{0:N}'}" />
海风掠过北极光 2024-09-12 01:05:54

Visual Studio 2008 IDE 的 XAML 语法解析器有几个错误,它会抱怨某些有效的 XAML 无效。

这种逃避方法对你有用吗?

StringFormat=\{0:N\}

Visual Studio 2008 IDE's XAML syntax parser has several bugs where it complains that certain valid XAML is invalid.

Does this method of escaping work for you?

StringFormat=\{0:N\}
送你一个梦 2024-09-12 01:05:54

我相信它只能在目标属性为 String 类型时使用。

I believe it can only be used when the target property is of type String.

平定天下 2024-09-12 01:05:54

我的猜测是,您使用单引号打开属性值,但使用双引号关闭它。但这只是一个猜测。

请发布引用的代码行,以便我们为您提供更好的反馈。

My guess is that you are opening your attribute value using a single quote but closing it using a double-quote. But that is only a guess.

Please post the referenced line of code so we can give you better feedback.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文