Thursday, November 26. 2009
SharedSize Grid with Silverlight
Since there is no SharedSizeGroup property for the Silverlight Grid I decided to code that myself. It is really helpful if you design a page with multiple Grids on it.
To give you an overview of the usage here is a Silverlight 3.0 XAML file
<UserControl x:Class="SLTestApp.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ext="clr-namespace:System.Windows.Controls.Extensions;assembly=System.Windows.Controls.Extensions"
mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
<Grid x:Name="LayoutRoot" Background="White" ext:SharedSize.IsSharedSizeScope="True">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid x:Name="firstfirstGrid" Grid.Row="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" ext:SharedSize.SharedSizeGroup="A"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" ext:SharedSize.SharedSizeGroup="A"/>
</Grid.ColumnDefinitions>
<Border BorderBrush="Green" BorderThickness="2">
<TextBlock x:Name="txtFirstFirst" >
<Run>aa</Run>
<LineBreak />
<Run>aa</Run>
</TextBlock>
</Border>
</Grid>
<Grid x:Name="firstsecondGrid" Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" ext:SharedSize.SharedSizeGroup="A"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" ext:SharedSize.SharedSizeGroup="A"/>
</Grid.ColumnDefinitions>
<Border BorderBrush="Blue" BorderThickness="2">
<TextBlock Text="aaaaaaaaaaaaaaaa" />
</Border>
</Grid>
</Grid>
</UserControl>
The current version only works in XAML and does not support adding a Grid or a SharedSize property in code and during runtime. If you need the code, let me know.
Download the release DLL
To give you an overview of the usage here is a Silverlight 3.0 XAML file
<UserControl x:Class="SLTestApp.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ext="clr-namespace:System.Windows.Controls.Extensions;assembly=System.Windows.Controls.Extensions"
mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
<Grid x:Name="LayoutRoot" Background="White" ext:SharedSize.IsSharedSizeScope="True">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid x:Name="firstfirstGrid" Grid.Row="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" ext:SharedSize.SharedSizeGroup="A"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" ext:SharedSize.SharedSizeGroup="A"/>
</Grid.ColumnDefinitions>
<Border BorderBrush="Green" BorderThickness="2">
<TextBlock x:Name="txtFirstFirst" >
<Run>aa</Run>
<LineBreak />
<Run>aa</Run>
</TextBlock>
</Border>
</Grid>
<Grid x:Name="firstsecondGrid" Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" ext:SharedSize.SharedSizeGroup="A"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" ext:SharedSize.SharedSizeGroup="A"/>
</Grid.ColumnDefinitions>
<Border BorderBrush="Blue" BorderThickness="2">
<TextBlock Text="aaaaaaaaaaaaaaaa" />
</Border>
</Grid>
</Grid>
</UserControl>
The current version only works in XAML and does not support adding a Grid or a SharedSize property in code and during runtime. If you need the code, let me know.
Download the release DLL
Sunday, August 23. 2009
Silverlight-Wishlist (Part I)
Up to now I've collected rather a bit of expericence in Microsoft Silverlight since its release to web.
Working with new technology always introduces some problems and shows what is still missing in "the new baby".
This article starts a little series to collect different things we found to be missing or at least "suboptimal" in silverlight. The entry will be updated or a new entry added when we find other noteworthy points.
I will start the series with some DataGrid and TreeView hickhacks (after the click). Continue reading "Silverlight-Wishlist (Part I)"
Working with new technology always introduces some problems and shows what is still missing in "the new baby".
This article starts a little series to collect different things we found to be missing or at least "suboptimal" in silverlight. The entry will be updated or a new entry added when we find other noteworthy points.
I will start the series with some DataGrid and TreeView hickhacks (after the click). Continue reading "Silverlight-Wishlist (Part I)"
Wednesday, May 27. 2009
Bring Light to your Silverlight
Ever wanted to know why the heck your brand new silverlight application crashes just once more...
Then check out the Silverlight Spy .
And, after I found out most of it myself in hard work, I finally found this great article about Silverlight Authentication patterns to be used with your silverlight app talking to your web service:
http://www.silverlightshow.net/items/Building-a-Silverlight-Line-Of-Business-Application-Part-3.aspx
I hope I made you cut the corner...
Then check out the Silverlight Spy .
And, after I found out most of it myself in hard work, I finally found this great article about Silverlight Authentication patterns to be used with your silverlight app talking to your web service:
http://www.silverlightshow.net/items/Building-a-Silverlight-Line-Of-Business-Application-Part-3.aspx
I hope I made you cut the corner...
Thursday, February 19. 2009
Silverlight DataGrid 1.1
I recently stumbled over a bug in the Silverlight 2.0 DataGrid.
If you try to edit a row in the DataGrid and change the ItemSource while in editing mode, you will see a blank line in the area of the edited row (like the first 'row' in the image below).

This also happens when the User has clicked e.g. a button or a CheckBox inside the DataGrid before you change the ItemsSource.
Do fix this issue, simply download a new version of the Silverlight DataGrid at the Microsoft Download Site
If you try to edit a row in the DataGrid and change the ItemSource while in editing mode, you will see a blank line in the area of the edited row (like the first 'row' in the image below).

This also happens when the User has clicked e.g. a button or a CheckBox inside the DataGrid before you change the ItemsSource.
Do fix this issue, simply download a new version of the Silverlight DataGrid at the Microsoft Download Site


/* Comments */