Mabster Does WPF
After Joesph Cooney's amazing WPF presentation at Code Camp Oz, I was inspired. I've been keeping track of WPF for years, but never quite had the gumption to try it myself until this week.
I've started small - a simple window with a ListBox showing all the issues in my Comicster collection. I was experimenting with DataTemplates to customize how each issue in the ListBox was displayed, and after a few hours managed to get it to look like the attached picture.
The idea of being able to make templates that you can apply either to data types or directly to lists is very cool. It's a bit hard when you're dealing with a DataSet, because usually your data comes into a bound control as a collection of DataRowView objects, rather than a strongly-typed object. You can get around that (and I have, as you'll see) by binding directly to the "Rows" collection of the table, but that's ugly.
One small tip that I've picked up in the last day or two: If you want to force all the items in your ListBox to the width of the ListBox itself (and hence not require the list to have a horizontal scrollbar) then all you need to do is disable the horizontal scrollbar on the ListBox itself. Here's some sample XAML (the exact code from my application so far):
<ListBox Grid.Column="1" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemTemplate="{StaticResource issueTemplate}" ItemsSource="{Binding Path=Issues.Rows}" />
Hope this helps someone out there - it took me ages to discover this.
In the meantime I'll keep reading Joseph's site, and also look back on some of the entries from Beatriz Costa's awesome blog about data binding in WPF.
Comments
# codefund
18/11/2007 2:49 PM
Reference:
www.msdner.com/.../11-34-987800.shtm