Mouse.GotMouseCapture 附加事件

定义

在元素捕获到鼠标时发生。Occurs when an element captures the mouse.

see AddGotMouseCaptureHandler, and RemoveGotMouseCaptureHandler
see AddGotMouseCaptureHandler, and RemoveGotMouseCaptureHandler
see AddGotMouseCaptureHandler, and RemoveGotMouseCaptureHandler

注解

当某个元素捕获鼠标时, 它将接收鼠标输入, 无论光标是否在其边界内。When an element captures the mouse, it receives mouse input whether or not the cursor is within its borders.

这是一个附加事件。This is an attached event. WPFWPF将附加事件作为路由事件实现。implements attached events as routed events. 附加事件本质上是XAMLXAML一种用于引用事件的语言概念, 这些事件可在未定义该事件的对象WPFWPF上进行处理, 后者通过同时启用事件来遍历路由。Attached events are fundamentally a XAMLXAML language concept for referencing events that can be handled on objects that do not define that event, which WPFWPF expands upon by also enabling the event to traverse a route. 附加事件在代码中没有直接处理语法;若要在代码中附加路由事件的处理程序, 请使用指定的 Add * 处理程序方法。Attached events do not have a direct handling syntax in code; to attach handlers for a routed event in code, you use a designated Add*Handler method. 有关详细信息, 请参阅附加事件概述For details, see Attached Events Overview.

由于冒泡路由, 具有捕获的实际元素可以是子元素, 而不一定是实际附加了事件处理程序的元素。Because of the bubbling routing, the actual element that has capture might be a child element, not necessarily the element where the event handler is actually attached. 检查事件Source参数中的, 以确定具有鼠标捕获的实际元素。Check the Source in the event arguments to determine the actual element that has mouse capture.

路由事件信息Routed Event Information

标识符字段Identifier field GotMouseCaptureEvent
路由策略Routing strategy 冒泡Bubbling
委托Delegate MouseEventHandler
  • 未定义相应的隧道事件。There is no defined corresponding tunneling event.

适用于