开发者

Context Menu vs Popup

Wha开发者_StackOverflowt 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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜