Click here to Skip to main content
15,867,330 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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.

XML
<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,
Posted

1 solution

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[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900