Reputation: 138041
I am making a small program for Windows 8, and I would like to let users with mouses the opportunity to right-click elements of a GridView
.
While GridViews have the ItemClick
event, these don't convey mouse buttons. They have a RightTapped
(what does that even mean?) event, but it doesn't convey the clicked item, just the event source.
How can I tell which model object was right-clicked?
Upvotes: 1
Views: 456
Reputation: 138041
I didn't think for very long before asking this question. The target object can be accessed through event.OriginalSource.DataContext
(once every bit in it has been casted to the appropriate class).
Extra care must be taken because right-clicking in the margins between grid elements still triggers the event, but on the GridView itself.
Upvotes: 2