WPF Mutibinding TextBlock 文本上的两个或多个绑定
WPF Mutibinding two or more binding on TextBlock Text
当我构建此样式 xaml 代码时,返回此错误:
Severity Code Description Project File Line Suppression State Error A 'Binding' cannot be set on the 'Path' property of type
'Binding'. A 'Binding' can only be set on a DependencyProperty of a
DependencyObject
如何多重绑定此绑定属性?
提前致谢。
<Style x:Key="TextBlockLastUnitStyle" TargetType="TextBlock">
<Setter Property="Text">
<Setter.Value>
<MultiBinding StringFormat="{}{0} : {1}">
<Binding Path="{Binding String57, Source={StaticResource CurrentResources}}" />
<Binding Path="{Binding LastUnitId,FallbackValue=-.-}" />
</MultiBinding>
</Setter.Value>
</Setter>
</Style>
MultiBinding 中的绑定使用 XML 标记语法而不是属性语法:
<Style x:Key="TextBlockLastUnitStyle" TargetType="TextBlock">
<Setter Property="Text">
<Setter.Value>
<MultiBinding StringFormat="{}{0} : {1}">
<Binding Path="String57" Source="{StaticResource CurrentResources}"/>
<Binding Path="LastUnitId" FallbackValue="-.-" />
</MultiBinding>
</Setter.Value>
</Setter>
</Style>
当我构建此样式 xaml 代码时,返回此错误:
Severity Code Description Project File Line Suppression State Error A 'Binding' cannot be set on the 'Path' property of type 'Binding'. A 'Binding' can only be set on a DependencyProperty of a DependencyObject
如何多重绑定此绑定属性? 提前致谢。
<Style x:Key="TextBlockLastUnitStyle" TargetType="TextBlock">
<Setter Property="Text">
<Setter.Value>
<MultiBinding StringFormat="{}{0} : {1}">
<Binding Path="{Binding String57, Source={StaticResource CurrentResources}}" />
<Binding Path="{Binding LastUnitId,FallbackValue=-.-}" />
</MultiBinding>
</Setter.Value>
</Setter>
</Style>
MultiBinding 中的绑定使用 XML 标记语法而不是属性语法:
<Style x:Key="TextBlockLastUnitStyle" TargetType="TextBlock">
<Setter Property="Text">
<Setter.Value>
<MultiBinding StringFormat="{}{0} : {1}">
<Binding Path="String57" Source="{StaticResource CurrentResources}"/>
<Binding Path="LastUnitId" FallbackValue="-.-" />
</MultiBinding>
</Setter.Value>
</Setter>
</Style>