According to this code:
<StackPanel>
<StackPanel.ContextMenu>
<ContextMenu>
<MenuItem Header="menuitem1"/>
<MenuItem Header="menuitem2"/>
</ContextMenu>
</StackPanel.ContextMenu>
<Button Width="100" Height="100"/>
<Button Width="100" Height="100"/>
</StackPanel>
If you right click on the Buttons then ContextMenu will appear, children will inherit their parent’s ContextMenu.
My question is how can I prevent this feature?
Edit: I need a way in xaml if it’s possible.
I found this solution