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

bkm*_*tan 3 wpf xaml string-formatting visual-studio-2008-sp1

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

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

Mat*_*ton 6

正如错误消息所暗示的那样,尝试将您的 StringFormat 值括在单引号中。例如:

<TextBlock Text="{Binding StringFormat='{}{0:N}'}" />
Run Code Online (Sandbox Code Playgroud)

  • 也许吧,但是将 StringFormat 值用单引号括起来对我来说很好用,我从 Microsoft 的示例代码中学到了它(尽管我不记得具体在哪里)。 (3认同)