Let's read these codes, I've defined two similar UserControls in a Windows Phone 8 project and I really want to which of them is better. I've check the profiling, it seems they are almost the same.
UserControl 1, using grid's property to design my layout.
<Grid x:Name="LayoutRoot" Background="{StaticResource PhoneChromeBrush}" Height="108">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Rectangle Grid.RowSpan="2" Grid.Row="0" Height="108" Width="54" Fill="Blue"></Rectangle>
<TextBlock Grid.Row="0" Grid.Column="1" Text="Caption" Style="{StaticResource PhoneTextExtraLargeStyle}"></TextBlock>
<TextBlock Grid.Row="1" Grid.Column="1" Text="URLURLURLURLURLURL" Style="{StaticResource PhoneTextSmallStyle}"></TextBlock>
</Grid>
UserControl 2, using StackPanel to design my layout.
<Grid x:Name="LayoutRoot" Background="{StaticResource PhoneChromeBrush}" Height="108">
<StackPanel Orientation="Horizontal">
<Rectangle Height="108" Width="54" Fill="Red"></Rectangle>
<StackPanel Orientation="Vertical">
<TextBlock Text="Caption" Style="{StaticResource PhoneTextExtraLargeStyle}"></TextBlock>
<TextBlock Text="URLURLURLURLURLURL" Style="{StaticResource PhoneTextSmallStyle}"></TextBlock>
</StackPanel>
</StackPanel>
</Grid>
It looks like the basic layout is the same. But when I use XAML Spy to analyse the Visualizing tree, UserControl 1 has less nodes, but it costs a little more memory. Why?