O'Reilly logo

XAML Unleashed by Adam Nathan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Binding to a Collection

One of the most common uses of data binding is to bind the items of an items control to a collection. You might try to assign a Binding to an items control’s Items property, but, alas, Items is not a dependency property. All items controls expose a separate ItemsSource dependency property that exists specifically for data binding. Therefore, if you have a Windows Store app with a Page as follows:

<Page ...>  <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">    <GridView ItemsSource="{Binding}" />  </Grid></Page>

with the following code-behind that sets the data context to a simple array:

using Windows.UI.Xaml.Controls;namespace Chapter17 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required