备用行样式定义为:
<Style TargetType="telerik:GridViewRow">
<Setter Property="Background" Value="{Binding Color,Converter={StaticResource dataToColorConverter}}">
</Style>
但我想在多个值上更新rowstyle depedninng。我希望实现这样的目标。
<Style>
<Setter Property="Background" >
<MultiBinding Converter={StaticResource dataToColorConverter}>
<Binding Path="Color"/>
<Binding ElementName="myListBox" Path="SelectedItem"/>
</MultiBinding>
</Setter>
</Style>
但是收到错误“类型'Setter'不支持直接内容。”
答案 0 :(得分:6)
由于Setter
元素不支持直接内容,因此您必须指定要设置Value
属性(在XAML中包含“&lt; Setter.Value&gt;”):
<Setter Property="Background" >
<Setter.Value>
<MultiBinding Converter="{StaticResource dataToColorConverter}" >
<Binding Path="Color" />
<Binding ElementName="myListBox" Path="SelectedItem" />
</MultiBinding>
</Setter.Value>
</Setter>