I have a ListBox as I show there. The fact is that in determining the subject I have a lot of material with grids and elements. I want to change the visibility of one image in an element only in order to make it visible only when the element itself is selected.
I managed to change, for example, the background and general appearance of the element when it is selected, but I can not access the internal elements :(
<ListBox stuff stuff stuff> <ListBox.ItemTemplate> <DataTemplate DataType="local:Patient"> <grids , borders, things, stuff <Image Name="image1" source opacity stuff/> </ grids bordes and design in general> </DataTemplate> </ListBox.ItemTemplate> <ListBox.ItemContainerStyle> <Style TargetType="{x:Type ListBoxItem}"> <Style.Triggers> <Trigger Property="IsSelected" Value="True"> <Setter Property="Foreground" Value="White"/> <!--HERE I WANT TO CHANGE VISIBILITY OF THE IMAGE--> </Trigger> </Style.Triggers> </Style> </ListBox.ItemContainerStyle> <ListBox.Template> <!-- some other styles when deselected and other things --> </ListBox.Template> </ListBox>
I tried using:
<Setter TargetName="physiciansSettinsImage" Property="Visibility" Value="Visible"/>
But it cannot be installed in Style Setter. Any clue?
The whole design is quite complex, so I would like to avoid as much conversion as possible.
source share