Live Chat Icon For mobile
Live Chat Icon

What are the data sources I can bind the ListBox to?

Platform: WPF| Category: ListBox

The ListBox, like the other ItemsControl can be bound to any IList, ObservableCollection or ObjectDataProvider (containing a list type data) as explained in this MSDN topic:

ItemsControl Content Model Overview

If bound to an ObservableCollection, changes happening in the collection will automatically reflect in the ListBox.

You can also bind to XML Data using an XMLDataProvider as explained in this topic:

How to: Bind to XML Data Using an XMLDataProvider and XPath Queries

Bind the ListBox to a CollectionViewSource to be able to bind to sorted or grouped views of your list.

CollectionViewSource Class

You can also bind to a DataTable in an ADO.NET DataSet as follows:

How to: Bind to an ADO.NET Data Source

Share with

Share on twitter
Share on facebook
Share on linkedin

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.