この質問をしたのが私が初めてかどうかはわかりませんが (ボード全体を検索しました)、答えは見つかりませんでした。タイトルで述べたように、右クリックするたびにリストボックス内のアイテムを強調表示/選択しようとしています。
XAML コードは次のとおりです。
<ListBox Grid.Row="1" x:Name="ContactList" Margin="6" ItemsSource="{Binding ''}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Source="{Binding Status_Image}" Margin="0,0,3,0" />
<StackPanel Orientation="Vertical">
<TextBlock Height="20" HorizontalAlignment="Left" Text="{Binding Name}" FontWeight="Bold" FontSize="13" Foreground="Black" />
<TextBlock Height="20" HorizontalAlignment="Left" Text="{Binding Message}" FontSize="11" Foreground="Gray" />
</StackPanel>
<Image Source="{Binding NotifImg}" Margin="8,0,0,0"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
右クリックを処理して、ボタンまたは単一の要素にコンテキスト メニューを表示する方法は知っていますが、バインドされたリストボックスには表示しません。どうすればいいのかアドバイスがあれば、今行き詰まっているので遠慮なく教えてください。
ありがとう、エピスメン。