I’ve got a WPF ListView that I’m using as a GridView. Is there any way I can get vertical gridlines in there?
The ListView has a MinHeight specified, so I’d like the GridLine to go all the way to the bottom of the grid, so it’ll fill the empty space.
This seems to be a rather tricky problem. Is is possible to solve?
This is how I do it.
The
SharedSizeGroupandGrid.IsSharedSizeScopeproperties are key to this way of doing it. TheMargin="0,-2"property on theBordermakes sure the dividing line looks like a continuous vertical line. If you add vertical margin to the two textblocks, you will need to increase the negative vertical margin of the border.This will take care of lining things up into two uniformly sized columns with a vertical line between them, but it won’t extend into areas where there is no data. A ListView might not be the best option if you want that functionality.
Adding some data to the

MyListproperty in the ViewModel gives this as a result:Of course, the
MyListproperty needs to be a list or collection of a class that hasNameandDateModifiedas properties.