【问题标题】:How can i add a % after a bindin WPF xaml?如何在绑定 WPF xaml 后添加 %?
【发布时间】:2018-04-25 01:45:47
【问题描述】:
<DataGridTextColumn 
    Header="Alcoholpercentage" 
    Binding="{Binding alcoholpercentage,StringFormat=% {0}}" 
    Width="auto"
    />

如何更改以使 % 在绑定之后?

【问题讨论】:

标签: wpf xaml binding


【解决方案1】:

{0}前面放上空花括号:

Binding="{Binding alcoholpercentage,StringFormat={}{0}%}"

【讨论】:

    【解决方案2】:

    使用值转换器。网上有很多例子。

    【讨论】:

      猜你喜欢
      • 2011-07-15
      • 2012-08-14
      • 2011-07-03
      • 2013-10-17
      • 2017-08-20
      • 2011-02-28
      • 2015-11-23
      • 2011-02-23
      • 2010-12-30
      相关资源
      最近更新 更多