I have a list in which you select a row / item. This is due to the data that displays the image in a row. The image should only be displayed when a row is selected.
This part works fine, however, when you move the focus to something else, such as a text field or message, a listviewitem is displayed, that is, the highlight in the line is no longer displayed. The problem is that my image still remains. It should be hidden / compensated when the listview loses focus ... It works great if you select another item / line in the list.
Can anyone help with this please?
<Style x:Key="deleteImageStyle" TargetType="{x:Type Image}">
<Setter Property="Source" Value="Resources/iconDelete.png" />
<Setter Property="Margin" Value="0,2,5,0" />
<Setter Property="Height" Value="16" />
<Setter Property="Width" Value="16" />
<Setter Property="HorizontalAlignment" Value="Right" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="Cursor" Value="Hand" />
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBoxItem}},Path=IsSelected}" Value="True">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBoxItem}},Path=IsSelected}" Value="False">
<Setter Property="Visibility" Value="Hidden"/>
</DataTrigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Visibility" Value="Hidden" />
</Trigger>
</Style.Triggers>
</Style>
Hello
Travispuk