0

我添加了一个 XAML 页面并尝试使用模拟器在横向模式下运行,它向我展示了 potrait 模式。

这是我的 XAML 页面代码:

<phone:PhoneApplicationPage 
    x:Class="PhoneApp1.Page1"
    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"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
    mc:Ignorable="d" d:DesignHeight="768" d:DesignWidth="480"
    shell:SystemTray.IsVisible="True">

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--ContentPanel - place additional content here-->
        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
            <Grid.RowDefinitions>
                <RowDefinition Height="70"/>

            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="190"/>
                <ColumnDefinition Width="290"/>
            </Grid.ColumnDefinitions>
            <TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="Text" VerticalAlignment="Center" Grid.Row="0" Grid.Column="0" Margin="30,0,0,0"/>
            <TextBox x:Name="txtAdd" TextWrapping="Wrap" VerticalAlignment="Top" FontSize="18.667" Grid.Row="0" Grid.Column="1"/>

        </Grid>
    </Grid>

    <!--Sample code showing usage of ApplicationBar-->
    <!--<phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1"/>
            <shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2"/>
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem Text="MenuItem 1"/>
                <shell:ApplicationBarMenuItem Text="MenuItem 2"/>
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>-->

</phone:PhoneApplicationPage>

谁能告诉我我在这里犯的错误?

4

2 回答 2

2

你有没有想过这个?如果@Jesper 建议的XAML 没有问题,那么它可能只是模拟器。我一直在使用模拟器来测试本地网站。我在旋转手机时遇到了同样的问题,但显示屏仍处于纵向模式。我意识到,如果我按下 Page Up 来使用我的键盘,那么它将始终让 IE 保持纵向模式。当我再次按下 Page Down 以使用电话输入时,横向工作正常。不确定这是一个错误还是故意的,但它可能与其他应用程序相同。

于 2012-04-30T17:04:14.280 回答
1

你的代码是正确的。您是否“旋转”了模拟器?模拟器窗口本身旁边的小工具栏中从顶部开始的第三个按钮。

于 2012-03-04T20:24:02.747 回答