How to orient WrapPanel items within ItemsControl lists vertically and horizontally
Some prefer to display items contained inside a WPF WrapPanel so that they can be scrolled vertically, others prefer horizontal scrolling. This post shows how to do both, by way of some simple tweaks. Step 1: Create a new Visual Studio project Step 2: Create a ViewModel Create a ViewModel class which we use to contain details about the items we wish to display in the WrapPanel. This could include image data, text etc. To keep things simple I'll just maintain a list of strings representing the title text of each displayed item. Right-click your project and select Add > New Item. Create our MainWindowViewModel.cs class: MainWindowViewModel.cs [code language="csharp"] using System.Collections.Generic; namespace ItemsControl { public class Item { public Item(string title) { Title = title; } public string Title { get; set; } } public class MainWindowViewModel { public MainWindowViewModel() ...