[英]Is it possible to use both a converter AND a StringFormat in WPF MultiBinding?
I am using the following MultiBinding. 我正在使用以下MultiBinding。 The converter outputs an int and the expected output of the MultiBinding is something like "SomeText|123".
转换器输出一个int,并且MultiBinding的预期输出类似于“ SomeText | 123”。 The Bindings and converter work fine, but the StringFormat doesn't seem to be applied - I just get the int value that the converter outputs.
绑定和转换器工作正常,但是StringFormat似乎没有应用-我只是获得了转换器输出的int值。 Is it possible to apply the StringFormat to the IMultiValueConverter's output?
是否可以将StringFormat应用于IMultiValueConverter的输出?
<MultiBinding Converter="{StaticResource MyConverter}"
StringFormat="SomeText|{}{0}">
<Binding />
<Binding Path="SomePath" />
</MultiBinding>
Thanks! 谢谢!
The issue was that I was binding to a property of type object. 问题是我绑定到类型对象的属性。 by changing this to a string property the stringformat was used as expected.
通过将其更改为字符串属性,可以按预期使用stringformat。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.