I have a ListView
with the following items:
1. One
2. Two
3. Three
4. Four
5. Five
When I hold one of this itens my hold event is fired and I get the content and the index of the item, but for me get the index I have to have press it before I hold it. I need to get the index when I hold the item, not having to press it before.
here is my code
private void ListViewItem_Holding(object sender, HoldingRoutedEventArgs e)
{
content = (sender as ListViewItem).Content.ToString();
index = historico.SelectedIndex;
}
Try this
private void ListViewItem_Holding(object sender, HoldingRoutedEventArgs e)
{
var item = (sender as FrameWorkElement).DataContext;
//find index
// index= yourItemSource.IndexOf(item );
}