is there an alternative to ItemContainerGenerator when working with a grouped LongListSelector?
I have a context menu on every ListBoxItem. One option is "delete item". This works fine with the following code (not really neat, but it works; better ways to implement?):
private void deleteItem(object sender, RoutedEventArgs e)
{
ViewModel drink = (sender as FrameworkElement).DataContext as ViewModel;
for (int i = 0; i < LLSGroups.Count; i++)
{
if (LLSGroups[i].Remove(drink))
break;
}
}
I'd like to animate the item upon deletion. Therefore I need the FrameworkElement of that ListBoxItem. With a usual ListBox it works with
FrameworkElement element = (MyList.ItemContainerGenerator.ContainerFromItem(((MenuItem)sender).DataContext) as ListBoxItem) as FrameworkElement;
The Problem: LongListSelectors do not implement ItemContainerGenerator. How do I get the FrameworkElement for the animation?
Best Regards,
Marc