Question

I'm wondering how I can get the "selected"Item on hold event on a grouped longlistselector in WindowsPhone 8 in C#.

I've already read eg. the following Hold Event Longlistselector

But this does not seem to work with a grouped Longlistselector.

Because of the Grouping, the DataContext of my LongListSelector is a List of Lists of the displayed items. Can I somehow access the item on which the hold-event occured?

(Or am I wrong at filling the grouped LongListSelector?)

Was it helpful?

Solution

In my code, I can get selected item from grouped LLS like this:

private void LLST_Hold(object sender, System.Windows.Input.GestureEventArgs e)
{
   if (LLST.SelectedItem != null)
   {
      ItemType item = LLST.SelectedItem as ItemType;
      // do some stuff
   }
}

If it's not working, maybe you can show some more code.

EDIT

Note also that hold event doesn't select it (that's maybe why it's not working in your code as you expect it). Check if hold works after selecting item with a tap first. You can read some more here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top