[UWP]如何多重绑定到IValueConverter? [英] [UWP] How to multiple binding to IValueConverter?
问题描述
在UWP上,
IMultiValueConverter 不支持。
On UWP, IMultiValueConverter doesn't support .
如何为此文本块进行多重绑定
How to multiple binding for this textblock
< TextBlock x:Name =" txtContentMessage" ; Text =" {Binding Text}" TextTrimming =" CharacterEllipsis"
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; TextWrapping = QUOT;包覆与QUOT; Foreground =" {Binding Entities,ConverterParameter = {Binding Text},Converter = {StaticResource
ChangedColorToUrlConverter},Mode = TwoWay}" MAXLINES = QUOT; 3英寸Grid.Row =" 1">< / TextBlock>
<TextBlock x:Name="txtContentMessage" Text="{Binding Text}" TextTrimming="CharacterEllipsis"
TextWrapping="Wrap" Foreground="{Binding Entities,ConverterParameter={Binding Text},Converter={StaticResource
ChangedColorToUrlConverter},Mode=TwoWay}" MaxLines="3" Grid.Row="1"></TextBlock>
推荐答案
GitHub上有很多项目通过附加属性模拟多个绑定,比如
这个。但是自周年纪念更新发布以来,IValueConverter还有一个替代方案:您的XAML可以直接调用函数。关于这个
的更多信息和示例
就在这里。
There are a lot of projects on GitHub that simulate multiple binding through attached properties, like this one. But since the release of Anniversary Update, there is an alternative for IValueConverter: your XAML can call functions directly. There's more info and an example on this right here.
这篇关于[UWP]如何多重绑定到IValueConverter?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!