Detecting right-click on XAML GridView control item
- by mbrit
Leaving aside why you would ever want to do this in a touch-centric world, here's how you tell if the right-mouse button has been clicked on a GridView in XAML/WinRT/Metro-style. You have to retrieve a point relative to the UI element you're in, and then query its properties. void itemGridView_PointerPressed(object sender, PointerRoutedEventArgs e)
{
if (e.GetCurrentPoint(this).Properties.IsRightButtonPressed)
{
this.BottomAppBar.IsOpen = true;
}
}
(The reason why you might want to do this can be explained by looking at any of the built-in Win8 apps. You can right-click any of the items on any list to bring up a context-sensitive AppBar.)