How to correctly set up a 'ContextMenu' in a ListView for Windows Phone 8.1? How to correctly set up a 'ContextMenu' in a ListView for Windows Phone 8.1? windows windows

How to correctly set up a 'ContextMenu' in a ListView for Windows Phone 8.1?


Once your click event is raised, you can get the DataContext of the FrameworkElement.

private void EditButton_Click(object sender, RoutedEventArgs e){    var datacontext = (e.OriginalSource as FrameworkElement).DataContext;    //this datacontext is probably some object of some type T (whatever is in your Items collections you haven't specified in your question)}