title: How to Hide Visibility of Individual PivotItem
body: <p>I have a few pivot items in my page, and based upon whether the app is in trial mode or not I need to show or hide one of the PivotItems. Setting the Visibility of the PivotItem directly in XAML or in C# only hides what is within the PivotItem, not the actual PivotItem itself. How can I accomplish this?</p>
  
  <p>In testing I've tried both of the following</p>
  
  <p>Page.xaml</p>
  
  <pre><code>&lt;phone:PivotItem x:Name="PivotItem2" Visibility="Collapsed"
                           Header="2"&gt;
                  ...
  &lt;/&lt;phone:PivotItem&gt;
  </code></pre>
  
  <p>OR</p>
  
  <p>Page.xaml.cs</p>
  
  <pre><code> protected override void OnNavigatedTo(NavigationEventArgs e)
      {
          base.OnNavigatedTo(e);
  
          //Check trial state and set PivotItem
          if ((Application.Current as App).IsTrial)
          {
              PivotItem2.Visibility = Visibility.Collapsed;
          }
          else
          {
              PivotItem2.Visibility = Visibility.Visible;
          }
      }
  </code></pre>