Social Icons

twitter google plus linkedin rss feed

Pages

15.11.12

Click works but Tapped Crashes on Windows 8

Our app has been rejected from the store because it crashes when the user taps in a GridView. As we don’t have a proper surface we were using the simulator to test our software but with the mouse tool not with the finger and it was working perfectly…

It crashes every time you tap in an item in a GridView and it’s funny, funny peculiar, not funny ha ha, because it crashes right in the tap, the code doesn't even get to the call-back, it just crashes. The crash info is not useful, as expected.

Looks like there’s a bug in the GridView and after it’s assigned to a populated DataContext it needs to be refreshed before it accepts Taps, even though it works fine with Clicks.

There’s no way or I haven’t found it of refreshing the UI in WinRT which I reckon it will solve this issue, so I have taken two different approaches to solve this bug.

  • Fast loading dashboards: I am preloading the contents of the fast loading dashboards once the app is executed. Doing this I get all of the GridViews populated in a page that is not being displayed to the users, in the background. Once the page where the GridView is selected by the user it’s rendered along with the GridView object refreshing it.
  • Slow loading dashboards: I am preloading the contents on this dashboards too but if the user clicks them right after the app loads they will still be loading causing the GridView to render just once after the DataContext is populated. In this cases I have changed the behaviour of the dashboard and I’m assigning the DataContext before and updating it several times, once every new chunk of data is received. This way the GridView gets refreshed once per chunk of new information and the issue with the tapping is solved.

The guys at the Windows Store App Lab said they will find a proper solution to this issue but I think this is the kind of bug that will be fixed through windows update. Anyway I’ll keep you posted if they come back with something new.

***UPDATE***
A Microsoft's expert pointed out that if you create and populate the GridView in code and add it to the page  it will work as expected. I've tested this and it's true.

The templates in my GridViews are complex so I'll make them user controls so I can create and populate them in code without loosing the MVVM approach. I still haven't tested this.