PointerPressed: left or right button?
PointerPressed is enough to handle mouse buttons:
void MainPage_PointerPressed(object sender, PointerRoutedEventArgs e)
{
// Check for input device
if (e.Pointer.PointerDeviceType == Windows.Devices.Input.PointerDeviceType.Mouse)
{
var properties = e.GetCurrentPoint(this).Properties;
if (properties.IsLeftButtonPressed)
{
// Left button pressed
}
else if (properties.IsRightButtonPressed)
{
// Right button pressed
}
}
}
You can use the following event to determine what pointer is used and what button is pressed.
private void Target_PointerMoved(object sender, PointerRoutedEventArgs e)
{
Windows.UI.Xaml.Input.Pointer ptr = e.Pointer;
Windows.UI.Input.PointerPoint ptrPt = e.GetCurrentPoint(Target);
if (ptrPt.Properties.IsLeftButtonPressed)
{
//Do stuff
}
if (ptrPt.Properties.IsRightButtonPressed)
{
//Do stuff
}
}