What is the difference between a ContextMenu
class and the Popup
class?
The MSDN docs do a nice job of displaying the distinction:
The Popup Class:
Represents a pop-up window that has content.
The ContextMenu Class:
Represents a pop-up menu that enables a control to expose functionality that is specific to the context of the control.
So the ContextMenu
is a more-specific version of a Popup
- it's meant to be bound to a specific control, providing ways to interact with that control. Read further on the MSDN page: the ContextMenu
has built-in facilities for displaying itself when you right-click on the associated control, and it is automatically displayed within a Popup
.
The Popup
class is much more general: it simply defines a barebones window (no default borders or decoration) that can display any arbitrary UIElement
on top of other controls (notice that the Popup
class is part of the Primitives namespace, meaning it's meant to be part of the composition of other controls, such as the ContextMenu
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With