WPF Tip: SharedSizeGroup

November 26, 2011

Suppose we want to display a set of objects in a ListBox (or other ItemsControl) using a DataTemplate that uses a Grid: <ListBox HorizontalContentAlignment="Stretch" x:Name="_list" >     <ListBox.ItemTemplate>         <DataTemplate>             <Border Margin="2" BorderBrush="Blue" BorderThickness="2" Padding="2">                 <Grid>                     <Grid.ColumnDefinitions>                         <ColumnDefinition Width="Auto" />                         <ColumnDefinition />                     </Grid.ColumnDefinitions>                     <TextBlock Text="{Binding Name}" FontSize="20" Margin="4" FontWeight="Bold" VerticalAlignment="Center"/>                     <TextBlock Text="{Binding Author}" FontSize="16" Grid.Column="1" VerticalAlignment="Center" Margin="10,4,4,4" />                 </Grid>             </Border>         </DataTemplate>     </ListBox.ItemTemplate> </ListBox> Running this sample with some of my favorite books, yields the following: Note the lack of alignment. How can we fix this? One...
tags: , , , ,
no comments

My C# 5.0 Async Session at Microsoft

November 22, 2011

Today I presented a session on C# 5.0 asynchronous programming. Thank you all for coming, it was a pleasure to present this interesting stuff. The presentation and demos are attached to this post. The NetFlix and RSS aggregator demos are part of the Async CTP installation. Any questions or comments are very welcome! OpenHouseAsyncProgC#5.NET4.5.zip OpenHouseAsyncProgC#5.NET4.5.zip

Mandelbrot Set with C# 5.0 Async support

November 21, 2011

I’ve always been fascinated by the Mandelbrot set. It’s an intriguing set, and the fractals created are truly mind boggling. (for more information on the Mandelbrot, and other such sets, you can start with the above Wikipedia link). As part of my preparation for tomorrow’s session on C# 5.0 asynchronous programming, I’ve decided to create a WPF application to view and explore the Mandelbrot set, while taking advantage of those new asynchronous features. This turned out to be rather fun. Here’s the initial output: Now you can mark a rectangular are to zoom in: ...

The Future of Silverlight

November 14, 2011

There’s been a lot of talk lately about Silverlight. Will Silverlight 5 (to be released this month) be the last major version of Silverlight? I don’t know, but here are my thoughts on the subject. Silverlight will stay in the context of Windows Phone, that’s seems pretty sure, but what about the web at large? Is Silverlight (and its rival, Adobe Flash) doomed? In recent years, there has been gravitation towards standards – that is, world wide standards, not Microsoft’s or anyone else’s for that matter. This is not a bad thing onto itself. But are the...
no comments