Search code examples
xamluser-controlswinui-3windows-app-sdk

How to capture PointerPressed event within whole user control rather than just on the elements inside? Windows App


I have a UserControl that i wish to capture the PointerPressed event on. Simply capturing the event on the user control itself like so:

<UserControl
    ...
    PointerPressed="UserControl_PointerPressed"
>

only invokes the event on mouse clicks on elements inside the control.

The control is outlined by a border, which i wish the event to be invoked when a click is made inside, but on most of the empty space within the border the event doesn't occur.

Is there a way of doing this?


Solution

  • Setting the background of the border in question to transparent did the trick