Using Grids with ItemsControl in XAML

ItemsControl in XAML is a useful control that allows you to bind against multiple items and have them displayed using a repeating template (or templates). It forms the basis of the ListBox and other controls but can be used on its own where extra behaviour such as selection is not needed.

By default the ItemsControl uses a vertically aligned StackPanel as the layout panel for its items but you can override this by providing a template. It’s quite common to override this for example to use a VirtualizingStackPanel but in this instance I wanted to use a Grid for layout.