Skip to Main Content
Windows Presentation Foundation 4.5 Cookbook
book

Windows Presentation Foundation 4.5 Cookbook

by Pavel Yosifovich
September 2012
Intermediate to advanced content levelIntermediate to advanced
464 pages
10h 55m
English
Packt Publishing
Content preview from Windows Presentation Foundation 4.5 Cookbook

Creating a list of items

Lists are typically used to show a collection of related objects. WPF provides several controls which can be used for that purpose, such as ListBox and ComboBox (which can be considered classic). All these derive from ItemsControl, which defines some basic functionality, such as an Items property. In this recipe, we'll take a quick look at ListBox and ComboBox. We'll reserve a more detailed explanation for Chapter 6, Data Binding, as this is the typical way list-based controls are used in WPF.

Getting ready

Make sure Visual Studio is up and running.

How to do it…

  1. Create a new WPF application named CH04.Lists.
  2. Open MainWindow.Xaml. Add two rows to the existing Grid, as follows:
    <Grid.RowDefinitions> <RowDefinition Height="Auto" ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Windows Presentation Foundation Development Cookbook

Windows Presentation Foundation Development Cookbook

Kunal Chowdhury

Publisher Resources

ISBN: 9781849686228Supplemental Content