title: Handling different orientations while developing Windows 8 Store applications
body: <p>I've been writing Android applications for some years and now I'm developing a Windows Store/Windows 8 application. </p>
  
  <p>I'm very confused about how to write different screen layouts for landscape and portrait orientations.</p>
  
  <p>In Android, all we must do is to write 2 layouts, one for portrait and another for landscape, following some name conventions for the file names, and when we rotate the device the platform changes the screen layout automatically.</p>
  
  <p>I've been googling for some solution to do the same in my Windows 8 application, and all I've found was a solution using Visual State Groups and Visual States, putting in the same XAML some modifications that happen to our widgets when we rotate the device.</p>
  
  <p>For example, to make a textblock change its position when I rotate the device to portrait orientation:</p>
  
  <pre><code>&lt;VisualState x:Name="FullScreenPortrait" &gt;
      &lt;Storyboard&gt;
          &lt;ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Grid.ColumnSpan)" Storyboard.TargetName="GridViewTitle"&gt;
              &lt;DiscreteObjectKeyFrame KeyTime="0"&gt;
                  &lt;DiscreteObjectKeyFrame.Value&gt;
                      &lt;x:Int32&gt;3&lt;/x:Int32&gt;
                  &lt;/DiscreteObjectKeyFrame.Value&gt;
              &lt;/DiscreteObjectKeyFrame&gt;
          &lt;/ObjectAnimationUsingKeyFrames&gt;
          &lt;ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="GridViewTitle"&gt;
              &lt;DiscreteObjectKeyFrame KeyTime="0"&gt;
                  &lt;DiscreteObjectKeyFrame.Value&gt;
                      &lt;Thickness&gt;0,10,10,807&lt;/Thickness&gt;
                  &lt;/DiscreteObjectKeyFrame.Value&gt;
              &lt;/DiscreteObjectKeyFrame&gt;
          &lt;/ObjectAnimationUsingKeyFrames&gt;
      &lt;/Storyboard&gt;
  &lt;/VisualState&gt;
  </code></pre>
  
  <p>It doesn't look very clean and simple to me, and even doing that using the Visual Studio's approach of dragging and dropping widgets to generate code I have the impression that there must be some easier and cleaner solution than what I'm doing.</p>
  
  <p>So my question is: is there any easier solution to write XAML layouts for each orientation or am I going the right, but hard way?</p>
  
  <p>Thanks!</p>