Getting the Listbox Item index when mouse over the item. (databinded items) RRS feed

  • Question

  • How do I get the listbox item's index when the mouse is over the item?


    Wednesday, November 20, 2013 2:55 PM


  • About your question you can get the datacontext of the "selected" item (You can cast the sender and after get its DataContext) and having the item you can look for the index, if you are using a datatemplate you can handle the MouseEnter event of the control that you are using to show the data. I think this is the easiest way to do it.

    But as far as I know on a touch screen you can't do something equivalent to a MouseOver, because the screen doesn't detect when you are dragging your finger over the items and in the most of the cases it isn't intuitive. And remember that accord to the design guides the UX should be similar in both situations using a mouse and keyboard or using a touch screen. If the MouseOver triggers a critical action probably MS don't accept your app in the Store just because it doesn't work well in a touch device. You can verify it on the simulator or using a touch device.

    Wednesday, November 20, 2013 7:45 PM