Answer the question
In order to leave comments, you need to log in
How to make different context menu for ListBox and ListBoxItem?
How to make different context menu for ListBox and ListBoxItem? Well, maybe not even a different menu, I need to have a clear all item on an empty space on the right button, and a delete item on the object.
Answer the question
In order to leave comments, you need to log in
WPF
<ListBox Name="ItemList"
ItemsSource="{Binding XXX}"
SelectedItem="{Binding Path=XXX, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, Mode=TwoWay}"
DisplayMemberPath="XXX">
<ListBox.ContextMenu>
<ContextMenu>
<MenuItem Header="Create" Command="{Binding CreateNewItemCommand}"/>
<MenuItem Header="Clone" Command="{Binding CloneSelectedItemCommand}"/>
<MenuItem Header="Delete" Command="{Binding DeleteSelectedItemCommand}"/>
</ContextMenu>
</ListBox.ContextMenu>
</ListBox>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question