title: Changing Supported Orientations
body: <p>I'm writing a Windows Phone app in C#. I have a setting <code>OrientationLock</code> that is supposed to lock the screen in portrait orientation. Unfortunately, I can't for the life of me get it to work. The setting saves and everything, I just can't figure out how to change the supported orientations in C#. Here's the code I'm trying to use:</p>
  
  <pre><code>public MainPage()
  {
      InitializeComponent();
  
      if (AppSettings.Default.OrientationLock)
      {
          this.SupportedOrientations = SupportedPageOrientation.Portrait;
      }
      else
      {
          this.SupportedOrientations = SupportedPageOrientation.PortraitOrLandscape;
      }
  }
  </code></pre>
  
  <p>Thanks.</p>