I'm trying to do my first WPF project, and I've started with this sample project for image display. Part of it is the XAML that binds a Listbox to an Array of images:
<ListBox.ItemsSource>
<x:Array Type="{x:Type ImageSource}">
<ImageSource>http://static.flickr.com/34/70703587_b35cf6d9eb.jpg</ImageSource>
<ImageSource>http://static.flickr.com/20/70703557_494d721b23.jpg</ImageSource>
<ImageSource>http://static.flickr.com/35/70703504_3ebf8f0150.jpg</ImageSource>
<ImageSource>http://static.flickr.com/35/70703474_18ef30450f.jpg</ImageSource>
</x:Array>
</ListBox.ItemsSource>
Now that is nice, but I would like to bind it to all Images in a Subfolder and it's subfolders that match a pattern. My Directory structure is this:
Archive
1994-01
Index.jpg
Page1.jpg
...
PageN.jpg
1994-02
Index.jpg
Page1.jpg
...
PageN.jpg
I want to bind the Listbox to the various Index.jpg images.
My normal approach would be to do some CodeBehind using System.IO and Directory.GetFiles, but as XAML seems rather powerful, I'm just wondering: Can this type of binding be achieved entirely in the XAML?
As said, total beginner in WPF and I want to do it the "proper" way, which seems to be DataBinding.