私はListBox
そこに見せるように宣言しました。重要なのは、アイテムの定義には、グリッドと要素を含むものがたくさんあるということです。アイテム内の1つの画像の表示を変更して、要素自体が選択されている場合にのみ表示されるようにします。
たとえば、アイテムが選択されたときに背景や全体的な外観を変更することができましたが、内部要素にアクセスできません:(
<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>
私は使ってみました:
<Setter TargetName="physiciansSettinsImage" Property="Visibility" Value="Visible"/>
ただし、スタイルセッターには設定できません。どんな手掛かり?
全体のデザインはかなり複雑なので、できるだけ再コーディングしないようにしたいと思います。