Microsoft Edge的开发文档阅读笔记。
- WebView2
- Advanced Topics and Best Practives
- Customize context menus
- 通过ContextMenuRequested用编口可以自定义上下文菜单,可以达成
- 添加一个自定义的上下文菜单,应用自行处理ContextMenuRequested,并根据提供的参量来弹出菜单
- 此情况下,需要申请一个deferral
- 添加默认的条目到自定义上下文菜单
- 添加自定的条目到自定义上下文菜单
- 从默认的上下文菜单中删除默认或者自定的菜单条目
- 禁用上下文菜单
- 添加一个自定义的上下文菜单,应用自行处理ContextMenuRequested,并根据提供的参量来弹出菜单
- 术语
- menu item,一个宽泛的术语,包含checkbox, command, radio button, separator以及submenu
- command,一个收窄的术语,五种menu item之一
- context menu,默认的或者自定义的上下文菜单
-
Adding a custom context menu
- 自定义菜单需要通过SelectedCommandId来告诉WebView2控件那个被调用的命令
- 关于C#和C++例子
-
Example: Adding a custom context menu
-
Adding menu items to a context menu
-
Adding custom menu items to a default context menu
-
Example: Adding custom menu items to a default context menu
-
Removing menu items from a default context menu
-
Example: Removing menu items from a default context menu
-
Detecting when the user requests a context menu
-
Detecting when the user selects a custom menu item
-
Reporting a selected command menu item to WebView2
-
Disabling context menus
-
API Reference overview
- 通过ContextMenuRequested用编口可以自定义上下文菜单,可以达成
- Customize context menus
- Advanced Topics and Best Practives