私は次のスタイルを自分に適用する必要がありますListViewItem
:
<UserControl.Resources>
<local:Look x:Key="ListViewItemLook" Background="Magenta"/>
<Style x:Key="ListViewItemStyle" TargetType="{x:Type ListViewItem}">
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="{Binding Source={DynamicResource ListViewItemLook}, Path=Background}"/>
</Trigger>
</Style.Triggers>
</Style>
しかし、私は例外を受け取ります、私は変更しようとします:
<Setter Property="Background" Value="{Binding Path=Background}"/>
そして、スタイルに追加します。
<Setter Property="DataContext" Value="{DynamicResource ListViewItemLook}"/>
しかし、動作しません。BackGroundプロパティを実行時に設定する必要があるため、StaticResourceにバインドできません。
私は何をしなければなりませんか?ありがとう。