Keyboard.PreviewKeyDown 附加事件

定義

按下鍵盤上的按鍵時發生。Occurs when a key on the keyboard is pressed.

see AddPreviewKeyDownHandler, and RemovePreviewKeyDownHandler
see AddPreviewKeyDownHandler, and RemovePreviewKeyDownHandler
see AddPreviewKeyDownHandler, and RemovePreviewKeyDownHandler

備註

這是附加事件。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.

路由事件資訊Routed Event Information

識別碼欄位Identifier field PreviewKeyDownEvent
路由策略Routing strategy 隧道Tunneling
代理人Delegate KeyEventHandler
  • 對應的反升事件為 KeyDownThe corresponding bubbling event is KeyDown.

適用於