WPF Controls with MVVM: ItemsControl

How do you put a list of objects on a WPF form dynamically so that if you add or remove an entry, the controls for it are added or removed? In this installment of the WPF Controls mini-series, we are going to look at one possible solution, which is to use the ItemsControl. This is one of those controls that is actually rather easy to use but is, at the same time, also confusing to a lot of people. Let’s clear up that confusion. Full courses: Source Code: Patreon: Newsletter signup: 0:00 - Intro 1:42 - Demo app overview 3:25 - Creating ItemsControl 5:40 - Displaying data: ItemsTemplate 11:52 - Note on data layout 13:41 - Changing layout: ItemsPanelTemplate 17:12 - Changing data set: add and remove buttons 27:42 - Bugs to expect when changing data 30:12 - Summary and concluding remarks Thanks to Ralfs HBK for the chapter breakdown
Back to Top