Search code examples
windows-phone-7windows-phone-8windows-phonewindows-phone-8.1windows-phone-7.1

Windows Phone 7.x does not show content to all screen size


I've found the problem. The same xaml does not shown for all screen size in W.P. 7.1 but does in W.P. 8. There is standard project template with red border to see difference:

<phone:PhoneApplicationPage 
x:Class="PhoneApp1.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
shell:SystemTray.IsVisible="True">
<Border BorderBrush="Red" BorderThickness="2">
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
            <TextBlock x:Name="ApplicationTitle" Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}"/>
            <TextBlock x:Name="PageTitle" Text="page name" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
        </StackPanel>
        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"></Grid>
    </Grid>
</Border>

Please, see screenshots - http://wp-hub.in.ua/all.png

Left part is running with 7.1 target for project, right - 8.0 Reproducing only for emulator 720p. Notice, even if run 7.1 targeted app on WinPhone 8.0 it has same problem. So the reason is not in device, but on selected target on project properties.

How to fix it? Thank you.


Solution

  • This is by-design for app-compat reasons. Windows Phone 7.x apps are designed and tested to run on phones that are 480 x 800 pixels (9:15 aspect ratio). When run on newer Windows Phone 8.x devices with 9:16 screens (like 720p or 1080p) there is too much space and some apps wouldn't know what to do with that space. So for apps built for WP 7.x, the OS just reserves the top part of the screen and lies to the app, telling it that it is still 480 x 800 pixels.