Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Context Menu vs Popup

What is the difference between a ContextMenu class and the Popup class?

like image 462
Kiang Teng Avatar asked Dec 10 '10 01:12

Kiang Teng


1 Answers

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).

like image 58
Dan J Avatar answered Nov 07 '22 05:11

Dan J