Thursday, April 10, 2014

Rotation Support or Automatic Multi-Orientation Layout Support for Windows Phone

SupportedPageOrientation.Portrait | SupportedPageOrientation.Landscape;
 
 
 
 
 
<Grid x:Name="LayoutRoot" 
Background="{StaticResource PhoneBackgroundBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid x:Name="TitleGrid" Grid.Row="0">
<TextBlock Text="Twitter Search"
x:Name="textBlockPageTitle"
Style="{StaticResource PhoneTextPageTitle1Style}"/>
<TextBlock Text="Search Results"
x:Name="textBlockListTitle"
Style="{StaticResource PhoneTextPageTitle2Style}"/>
</Grid>
<Grid x:Name="ContentGrid" Grid.Row="1">
</Grid>
</Grid>
<DataTemplate>
<StackPanel >
<Image Source="{Binding Mode=OneWay, Path=Avatar}"
Margin="5,0,10,0" Width="75" Height="75"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
<TextBlock Text="{Binding Mode=OneWay, Path=Title}"
HorizontalAlignment="Stretch" VerticalAlignment="Center"
Style="{StaticResource PhoneTextSmallStyle}"
TextWrapping="Wrap" />
</StackPanel>
</DataTemplate>
<DataTemplate>
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Bottom" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Image Source="{Binding Mode=OneWay, Path=Avatar}"
Margin="5,0,10,0" Width="75" Height="75" Grid.Column="0"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
<TextBlock Text="{Binding Mode=OneWay, Path=Title}" Grid.Column="1"
HorizontalAlignment="Stretch" VerticalAlignment="Center"
Style="{StaticResource PhoneTextSmallStyle}"
TextWrapping="Wrap" />
</Grid>
</DataTemplate> 
 

No comments:

Post a Comment