I ran into a bug doing some layout with nested controls. Here's a simplified repro:
In WPF setting HorizontalAlignment on a control will let it resize itself if it's inside a stretched element. For example:
<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="Auto" Width="Auto">
<Grid>
<StackPanel>
<Button Content="asd" HorizontalAlignment="Center" />
</StackPanel>
</Grid>
</Window>
This will show a button not much larger than it's content, centered in the Window. However, doing the same in Silverlight fails:
<UserControl x:Class="SilverlightApplication1.Page"
xmlns="http://schemas.microsoft.com/client/2007"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="Auto" Height="Auto">
<Grid>
<StackPanel>
<Button Content="asd" HorizontalAlignment="Center" />
</StackPanel>
</Grid>
</UserControl>
The button is stretched across the entire window.
My WPF-layout-powers are not that strong, so it's quite possible that I'm missing something here. But it does appear as if SL isn't behaving how it should.
Thanks,
Michael