1

We're currently developing an Xbox One and a Windows 8.1 app, which share the same codebase, and I'm running into an issue with the 'pointerover' (or hover-state) in of a listView item in the WinJS.UI.ListView.

The listview item has an eventListener, pointerover. However, this only seems to work on the first 10 items in the WinJS.UI.ListView although I see 16 items on screen, and the WinJS.UI.ListView gives me:

indexOfFirstVisible = 0
indexOfLastVisible = 15

The eventListener my listItem has, is:

mediaTile.element.addEventListener("pointerover", function (that) {
   that._allItemsListView.currentItem = { hasFocus: true, index: this.tileIndex };
}.bind(mediaTile, this));

When I add a breakpoint, it get's hit but only for the first 10 items although there are 16 items on screen.

Does anyone know what I'm missing here?

Thanks in advance!

2 Answers2

0

My guess is you're getting bitten by ListView visualization. Perhaps tiles higher than 10 don't yet exist when you bind your event listener, but they appear on screen quickly enough that it isn't obvious.

I'm not expert enough to advise a concrete way around this. Conceptually you could listen for an event when new items are added to the list (on the list itself) and then add your pointerover event to the new items.

Matt Cooper
  • 927
  • 9
  • 16
0

Yes, that seemed to be the case when you look at it from a distance; another developer took over, and we also migrated from WinJS 1.0 to WinJS 2.0, which seems to solve a lot of these problems.

Up until today I'm not sure what the exact problem was; we also played with the fetch limit of the datasource and this also seem to have played a part in solving the problem.

I'm sorry I can't be more thorough in my answer; I would have to ask the developer (if he still remembers) what the problem was, but afaik the major improvement was moving to WinJS 2.0.