mirror of
https://github.com/Stone-Red-Code/docs-desktop.git
synced 2026-09-04 09:06:04 +02:00
* Reset branch for WPF changes * Convert BMP to PNG; fix link-out-of-scope err * Add snippets for WPF... 6794 files!!!! * Add missing snippets * update file updated between migration * Fix paths to include * update breadcrumb and toc * fix index links * fix index links * fix index links * fix markdown
1.3 KiB
1.3 KiB
title, ms.date, helpviewer_keywords, ms.assetid
| title | ms.date | helpviewer_keywords | ms.assetid | |||
|---|---|---|---|---|---|---|
| How to: Bind a ListBox to Data | 03/30/2017 |
|
de93a907-709a-44a7-84bf-578b846a3d8b |
How to: Bind a ListBox to Data
An application developer can create xref:System.Windows.Controls.ListBox controls without specifying the contents of each xref:System.Windows.Controls.ListBoxItem separately. You can use data binding to bind data to the individual items.
The following example shows how to create a xref:System.Windows.Controls.ListBox that populates the xref:System.Windows.Controls.ListBoxItem elements by data binding to a data source called Colors. In this case it is not necessary to use xref:System.Windows.Controls.ListBoxItem tags to specify the content of each item.
Example
[!code-xamlListBoxEvent#7]
[!code-xamlListBoxEvent#3]