3
Vote

howto get the selected ContextMenu item in a LongListSelector?

description

I have a problem, I need to get the selected Item from a ContextMenu in a LongListSelector.
Before I was using a normal ListBox and I did it with:
 
var selectedItem = myList.ItemContainerGenerator.ContainerFromItem(menuItem.DataContext) as ListBoxItem;
 
But now I'm using the LongListSelector and this method doesn't work.
 
Who can I do it?

comments

halocameo wrote Jul 9, 2012 at 2:12 AM

Any update on this? I am facing the same issue!

lirkki wrote Nov 29, 2012 at 7:12 AM

If you only need the DataContext of the selected LongListSelector item, this should help you: http://stackoverflow.com/questions/8853909/howto-get-the-selected-contextmenu-item-in-a-longlistselector

If you really need the LongListSelector ListBoxItem (the actual UI control), then I don't know how to help.