title: Finding a UIElement's true position when within a PivotItem
body: <p>I'd like to get the on-screen position and visibility of a <code>TextBlock</code> which is embedded in a <code>PivotItem</code> - e.g. the on-screen position and visibility of <code>TB2</code> in:</p>
  
  <pre><code>    &lt;phone:Pivot&gt;
          &lt;phone:PivotItem Header="first"&gt;
              &lt;TextBlock x:Name="TB1" Text="Hello 1"&gt;&lt;/TextBlock&gt;
          &lt;/phone:PivotItem&gt;
  
          &lt;phone:PivotItem Header="second" &gt;
              &lt;TextBlock x:Name="TB2" Text="Hello 2"&gt;&lt;/TextBlock&gt;
          &lt;/phone:PivotItem&gt;
  
          &lt;phone:PivotItem Header="three" &gt;
              &lt;TextBlock x:Name="TB3" Text="Hello 3"&gt;&lt;/TextBlock&gt;
          &lt;/phone:PivotItem&gt;
      &lt;/phone:Pivot&gt;
  </code></pre>
  
  <p>For other Xaml controls I have achieved this using code like:</p>
  
  <pre><code>    public static Rect Position(this FrameworkElement element)
      {
          if (element.Visibility == Visibility.Collapsed)
              return Rect.Empty;
  
          if (element.Opacity &lt; 0.01)
              return Rect.Empty;
  
          // Obtain transform information based off root element
          GeneralTransform gt = element.TransformToVisual(Application.Current.RootVisual);
  
          // Find the four corners of the element
          Point topLeft = gt.Transform(new Point(0, 0));
          Point topRight = gt.Transform(new Point(element.RenderSize.Width, 0));
          Point bottomLeft = gt.Transform(new Point(0, element.RenderSize.Height));
          Point bottomRight = gt.Transform(new Point(element.RenderSize.Width, element.RenderSize.Height));
  
          var left = Math.Min(Math.Min(Math.Min(topLeft.X, topRight.X), bottomLeft.X), bottomRight.X);
          var top = Math.Min(Math.Min(Math.Min(topLeft.Y, topRight.Y), bottomLeft.Y), bottomRight.Y);
          var position = new Rect(left, top, element.ActualWidth, element.ActualHeight);
  
          return position;
      }
  </code></pre>
  
  <p>However, for <code>PivotItem</code> children this calculation doesn't provide the expected answers when the <code>PivotItem</code> is off-screen. Instead it provides the answer of the position the item will take on-screen when the <code>PivotItem</code> is swiped back on-screen. During a transition, I can see that the position is correctly calculated using the above method - e.g. during the transition I will see the position correctly swipe in from the left/right of the screen.</p>
  
  <p>I've looked through other properties like <code>Visible</code> and <code>Opacity</code> to see if there is some other mechanism being used here to hide the off-screen PivotItem or one of its <code>Parent</code>, <code>GrandParent</code>, etc - but all of those seem to yield <code>Visible</code> and <code>Opacity == 1.0</code> results.</p>
  
  <p>I've also tried iterating the VisualTree to see if any element with a solid background is masking the "off-screen" <code>PivotItem</code>s - but I can't see any in the tree.</p>
  
  <p>Is there some other property to consider here? How are the <code>PivotItem</code> contents hidden when they are "off-screen"? If I really have to, I know that I can use the <code>SelectedIndex</code> property of the <code>Pivot</code> to try to help with the <code>PivotItem</code> position calculations, but I'm hoping to avoid <code>SelectedIndex</code> if I can - I'd prefer to get the position using general Xaml and VisualTree methods if at all possible.</p>