Skip to content

Latest commit

 

History

History
27 lines (18 loc) · 2 KB

control_onpointerpressed_1718956371.md

File metadata and controls

27 lines (18 loc) · 2 KB
-api-id -api-type
M:Windows.UI.Xaml.Controls.Control.OnPointerPressed(Windows.UI.Xaml.Input.PointerRoutedEventArgs)
winrt method

Windows.UI.Xaml.Controls.Control.OnPointerPressed

-description

Called before the PointerPressed event occurs.

-parameters

-param e

Event data for the event.

-remarks

As it's implemented directly on Control, OnPointerPressed has an empty implementation. But each ancestor in a control's hierarchy may have provided an implementation. You won't be able to see this implementation because it's internal native code. In some cases a control will already have existing OnEvent overrides that mark the event Handled. OnPointerPressed happens to be an OnEvent event that several Windows Runtime XAML controls have provided overrides for. For example, ButtonBase has overridden OnPointerPressed to mark the event Handled. What all buttons do instead is to then raise the Click event that represents a higher-level event behavior for that control. That means you won't easily be able to handle UIElement.PointerPressed on a button, but you probably shouldn't be handling it anyways for most scenarios. Just use Click instead.

-examples

-see-also

UIElement.PointerPressed, PointerRoutedEventArgs, Events and routed events overview, Custom user interactions, Handle pointer input