<p>I have a problem, I need to get the selected Item from a ContextMenu in a LongListSelector.</p>
<p>Before I was using a normal ListBox and I did it with:</p>
<p> </p>
<p> var selectedItem = myList.ItemContainerGenerator.ContainerFromItem(menuItem.DataContext) as ListBoxItem;</p>
<p> </p>
<p>But now I'm using the LongListSelector and this method doesn't work.</p>
<p> </p>
<p>Who can I do it?</p>
Comments: ** Comment from web user: lirkki **
<p>Before I was using a normal ListBox and I did it with:</p>
<p> </p>
<p> var selectedItem = myList.ItemContainerGenerator.ContainerFromItem(menuItem.DataContext) as ListBoxItem;</p>
<p> </p>
<p>But now I'm using the LongListSelector and this method doesn't work.</p>
<p> </p>
<p>Who can I do it?</p>
Comments: ** Comment from web user: lirkki **
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.