Taming Windows 10 ListView for Good

I have been playing around with the UWP model that Windows 10 introduced. Recently, I needed to display an album of images in vertically scrolling views. Age old well known ListBox is a one obvious choice in the case. However, ListView in Windows 10 (and Windows 8.1, as far as I remember) comes with a host of new features and performance improvements like virtualization, instantly making it a better choice for displaying heavy content like images. In my (admittedly limited) testing, ListBox gave a small flicker as new images were rendered while ListView was smooth.

The Problem

However, the ListView also comes with bunch of fancy animations (such as tilt on press/click) that prove oddly disorienting when applied on large items. Time to get rid of those! What can a person do but fire up Blend, Select the ListView > Edit Additional Templates > Edit ItemContainerStyle > Edit a Copy. Now, natural course of action would be to find visual states like pressed, selected and remove the animations. But where are those states! This is all we get in the template:

I have removed all the other parts, but as can be seen, there are no usual Grid elements and visual states. There’s just a ListViewItemPresenter. That doesn’t really allow you to change appearance and behaviors.

The Solution

Turns out, Windows 10 ships with two different ItemContainerStyles for ListView. It’s the second style – ListViewItemExpanded as they call it – that we are interested in. It ships with UIElement tree and visual states instead of a ListViewItemPresenter. Here it is, in all its glory:

Now, we can disable visual states and customize templates at our heart’s content. The whole thing has been documented here at MSDN. Hope that helps!