I have an image that I want to show only when a ListViewItem
is selected. The code I have isn't working, but I think it illustrates what I want to accomplish.
<GridViewColumn>
<GridViewColumn.CellTemplate>
<DataTemplate>
<Image Height="20">
<Image.Style>
<Style TargetType="{x:Type Image}">
<Setter Property="Visibility" Value="Collapsed" />
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource=
{
RelativeSource
Mode=FindAncestor,
AncestorType={x:Type ListViewItem}
}, Path=IsSelected}" Value="True">
<Setter Property="Visibility" Value="Visible" />
<Setter Property="Source" Value="/Russound.Windows;component/Resources/2leftarrow-64.png" />
<Setter Property="ToolTip" Value="Selected" />
</DataTrigger>
</Style.Triggers>
</Style>
</Image.Style>
</Image>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>