Vah*_*hid 3 c# xaml bind string-formatting ivalueconverter
我正在尝试将 a 的标题文本绑定GroupBox到一个属性并使用StringFormat.
第一部分工作,它按预期返回文本。但我希望对最终文本进行格式化。例如,当我返回时,cm我希望它显示为Foundation Height (cm),但下面的代码仅显示cm.
<GroupBox Header="{Binding CurrentTargetUnit,
Converter={StaticResource QuantityToTextConverter},
ConverterParameter={x:Static enumerations:Quantity.Length},
StringFormat='Foundation Height ({0})'}">
</GroupBox>
Run Code Online (Sandbox Code Playgroud)
尝试不加引号
....
StringFormat=Foundation Height ({0})}">
Run Code Online (Sandbox Code Playgroud)
更新
由于您已将绑定用于标头,因此您应该HeaderStringFormat改用。
....
HeaderStringFormat=Foundation Height ({0})}">
Run Code Online (Sandbox Code Playgroud)
阅读文档了解更多
| 归档时间: |
|
| 查看次数: |
1871 次 |
| 最近记录: |