DataTrigger with Value Binding
Why this doesn't work?
<Style x:Key="ItemContStyle" TargetType="{x:Type Lis开发者_StackOverflow社区tViewItem}">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=Asset}"
Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type Window}},
Path=CurrentAsset}">
<Setter Property="Background" Value="Red" />
</DataTrigger>
</Style.Triggers>
Because DataTrigger.Value
is not a dependency property.
Used StyleSelector instead...
精彩评论