New Here?
My name is Nir and I'm the founder of Nbd-Tech, this blog is about things that interest me, so you can find posts on productivity, running a software company and obscure technological topics.
If you like what you read you can
subscribe to the blog feed or
follow me on twitter.
This is a part of the WPF image viewer tutorial: Introduction, Part 1, Part2.
In this part we'll connect the C# code with the XAML UI, just open Window1.xaml, find the Grid element and add the following line between <Grid> and </Grid>
<ListBox ItemsSource="{Binding AllImages}"/>
This will create a list box and bind it's ItemsSource property to the AllImages property we wrote in the last part, it you'll run this you will get a window with a list box covering the entire window and the list box showing the names of all the image files.
The reason we set the DataContext in the code is just to save us the little extra work of specifying where to get AllImages from (the default is from the DataContext).
This is how easy it is to databind just about anything in WPF, in the next part we'll do some more data binding and get our image viewer to actually view images.
posted @ Monday, August 20, 2007 12:54 PM