Note that there are some explanatory texts on larger screens.

plurals
  1. POWindows phone columns and grids during orientation change
    text
    copied!<p><img src="https://i.stack.imgur.com/Jo7lH.jpg" alt="enter image description here">Hey people I have this in my xml</p> <pre><code>&lt;Grid x:Name="LayoutRoot" Background="Black"&gt; &lt;Grid Background="Black"&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height="72"/&gt; &lt;RowDefinition Height="*"/&gt; &lt;RowDefinition Height="90"/&gt; &lt;/Grid.RowDefinitions&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width="72"/&gt; &lt;ColumnDefinition Width="*"/&gt; &lt;ColumnDefinition Width="90"/&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;StackPanel x:Name="FirstBorder" Background="Red" Grid.Column="0" Grid.ColumnSpan="1" Grid.Row="0" Grid.RowSpan="3"/&gt; &lt;Grid Grid.Column="1" Grid.Row="0" Grid.RowSpan="3" x:Name="LivePreviewTapTarget"&gt; &lt;Canvas&gt; &lt;Rectangle x:Name="CameraRectangle" Width="638" Height="480" Fill="{Binding PreviewBrush}"&gt; &lt;Rectangle.RenderTransform&gt; &lt;CompositeTransform x:Name="LivePreviewTransform"/&gt; &lt;/Rectangle.RenderTransform&gt; &lt;/Rectangle&gt; &lt;/Canvas&gt; &lt;/Grid&gt; &lt;Border x:Name="SecondBorder" Background="Yellow" Grid.Column="2" Grid.Row="0" Grid.RowSpan="3"&gt;&lt;/Border&gt; </code></pre> <p>And even this red panel is in first column only, when I run the app, it expands somehow (you can see that on the image attached, there is red border over camera view). What am I doing wrong? </p> <p>NEW PROBLEM!</p> <p>When I change page rotation I get this in portrait view. The xaml of the page is the same. And I do this in OnOrientationChanged event handler.</p> <pre><code>if (IsPortrait(Orientation)) { Grid.SetRow(FirstBorder, 0); Grid.SetColumn(FirstBorder, 0); Grid.SetColumnSpan(FirstBorder, 3); Grid.SetRow(LivePreviewTapTarget, 1); Grid.SetColumn(LivePreviewTapTarget, 0); Grid.SetColumnSpan(LivePreviewTapTarget, 3); Grid.SetRow(SecondBorder, 2); Grid.SetColumn(SecondBorder, 0); Grid.SetColumnSpan(SecondBorder, 3); CameraRectangle.Width = 480; CameraRectangle.Height = 638; } else { Grid.SetColumn(FirstBorder, 0); Grid.SetRow(FirstBorder, 0); Grid.SetRowSpan(FirstBorder, 3); Grid.SetColumn(SecondBorder, 2); Grid.SetRow(SecondBorder, 0); Grid.SetRowSpan(SecondBorder, 3); Grid.SetColumn(LivePreviewTapTarget, 1); Grid.SetRow(LivePreviewTapTarget, 0); Grid.SetRowSpan(LivePreviewTapTarget, 3); CameraRectangle.Width = 638; CameraRectangle.Height = 480; } if (IsPortrait(Orientation)) { _livePreviewTransform.Rotation = _viewModel.ViewfinderRotation; _livePreviewTransform.CenterX = 240; _livePreviewTransform.CenterY = 400; _livePreviewTransform.TranslateX = -100; _livePreviewTransform.TranslateY = -160; } else if (Orientation == PageOrientation.LandscapeRight) { _livePreviewTransform.Rotation = 180; _livePreviewTransform.CenterX = 400; _livePreviewTransform.CenterY = 240; _livePreviewTransform.TranslateX = -160; _livePreviewTransform.TranslateY = 0; } else { _livePreviewTransform.Rotation = 0; _livePreviewTransform.CenterX = 400; _livePreviewTransform.CenterY = 240; _livePreviewTransform.TranslateX = 0; _livePreviewTransform.TranslateY = 0; } var scaleX = 1.0; if (_viewModel.CameraSensorLocation == CameraSensorLocation.Front) scaleX = -1.0; _livePreviewTransform.ScaleX = scaleX; </code></pre> <p>Here is the page look in portrait mode.<img src="https://i.stack.imgur.com/FILz8.png" alt="enter image description here"> </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload