上下文菜单与弹出菜单 [英] Context Menu vs Popup

查看:52
本文介绍了上下文菜单与弹出菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ContextMenu 类和 Popup 类有什么区别?

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

推荐答案

MSDN 文档在显示区别方面做得很好:

The MSDN docs do a nice job of displaying the distinction:

Popup 类:

代表一个弹出窗口内容.

Represents a pop-up window that has content.

ContextMenu 类:

代表一个弹出菜单,可以启用用于公开功能的控件特定于上下文控制.

Represents a pop-up menu that enables a control to expose functionality that is specific to the context of the control.

所以 ContextMenuPopup 的更具体的版本 - 它旨在绑定到特定控件,提供与该控件交互的方法.在 MSDN 页面上进一步阅读:ContextMenu 具有用于在您右键单击相关控件时显示自身的内置工具,并且它会在 内自动显示>弹出窗口.

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.

Popup 类更通用:它只是定义了一个准系统窗口(没有默认边框或装饰),可以在其他控件之上显示任意 UIElement(请注意,Popup 类是 Primitives 命名空间,这意味着它是其他控件组合的一部分,例如 ContextMenu).

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

这篇关于上下文菜单与弹出菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆