Detecting right-click on XAML GridView control item
Posted
by mbrit
on Geeks with Blogs
See other posts from Geeks with Blogs
or by mbrit
Published on Sun, 24 Jun 2012 18:31:17 GMT
Indexed on
2012/06/24
21:16 UTC
Read the original article
Hit count: 277
Filed under:
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.)© Geeks with Blogs or respective owner