One of my customers has been using the Silverlight 2 DataGrid and came to me with a request: How do you make a column take up all of the rest of the available space (like the Grid * column width)? If I were doing this in MFC or Windows forms, I’d probable use inheritance to add this functionality but in Silverlight I thought about using a Custom Attached Property. The benefit of doing this is that it the code is very self-contained, it doesn’t add complexity to the grid class, and can be put into the declarative XAML. You can see this in the DataGrid StarColumn attribute in this DataGrid. In this instance, the third column will resize to the rest of the grid width:
<UserControl xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data" x:Class="GridProperties.Page"
<Grid x:Name="LayoutRoot" Background="White">
<data:DataGridTextColumn Header="Column 1"/>
<data:DataGridTextColumn Header="Column 2"/>
<data:DataGridTextColumn Header="Column 3"/>
Download the source code here.