在Windows Phone 8.1中禁用网格的方向更改 [英] Disable orientation change for a Grid in Windows Phone 8.1

查看:71
本文介绍了在Windows Phone 8.1中禁用网格的方向更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能禁用Windows Phone 8.1中特定元素的方向更改



以下是我要禁用方向更改的代码在gridONE网格上,即使屏幕方向更改为横向,网格仍然保留在纵向视图中。



Is there a possible way to disable the orientation change for a particular element in Windows Phone 8.1

Below is my code in which I want to disable the orientation change on the gridONE Grid so that even after the Screen Orientation changes to Landscape, the Grid still stays in the portrait view.

<Page

    x:Class="DemoUI.BlankPage1"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    xmlns:local="using:DemoUI"

    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

    mc:Ignorable="d"

    removed="{ThemeResource ApplicationPageBackgroundThemeBrush}">

    <Grid>

        <Grid x:Name="gridONE">
            <TextBox Text="This is a Sample TextBox" />
        </Grid>
        <Grid x:Name="gridTWO">
            
        </Grid>

    </Grid>
</Page>





我想确保当屏幕从纵向视图切换到横向视图时,网格的位置和方向不会改变。



谢谢,



I want to make sure that the position and orientation of the Grid does not changes when the screen changes to Landscape view from Portrait view.

Thanks,

推荐答案

您不能在页面的单个元素上设置方向,但可以为整个页面设置方向(并为每个页面设置不同的方向) ...

在此处阅读:在Windows Phone 8.1上的XAML中设置支持的方向 [ ^ ]
You can not set orientation on a single element of your page, but can do so for the whole page (and set it differently for each page)...
Read about it here: Set supported orientations in XAML on Windows Phone 8.1[^]


这篇关于在Windows Phone 8.1中禁用网格的方向更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆