No touch UWP FlipView

Corrado Cavalli
Corrado Cavalli
Published in
2 min readSep 27, 2018

A FlipView that doesn’t know about touch…

Related image

Probably the first question that comes to your mind is: why you wanna have it?.
The answer is that in my case FlipView is hosted inside another component that is heavily touch aware and FlipView likes to manage its own touch events internally with the result that overall effect is all but touch friendly, so the request seemed very easy: Disable all touch events from the FlipView, make both arrow buttons on sides always visible and cycle endlessly through items.
Ok, I thought… 10 minutes for this? but I underestimate the inner magic touch sequence and i ended up in a personal fight between me and the FlipView and… I won!

Ok, first of all, you need to edit the original template and set ManipulationMode of the contained ItemsPresenter to None.

Since my FlipView will never be used vertically, I cleaned up the template a bit so that it can more easy for you to inspect

This stile will stop all touch events, the problem now is that scroll buttons reveal themselves only when pointer overs the FlipView, something that we don’t have in case of a touch device.
To make things even more complicated looks like that internal code set template’s buttons opacity to zero when loaded, so the only way I’ve found is to create my own FlipView, called SmartFlipView, change the name of both buttons so that internal code gracefully degrades and let them visible all the time, inside OnApplyTemplate get a reference of those buttons and implement the ‘endless cycling’ functionality.

Here’s how to use it:

--

--

Corrado Cavalli
Corrado Cavalli

Senior Sofware Engineer at Microsoft, former Xamarin/Microsoft MVP mad about technology. MTB & Ski mountaineering addicted.