title: XAML controls not recognised in code-behind
body: <p>I have a strange problem where a XAML control is not visible in the code behind.  Here is a sample of the XAML:</p>
  
  <pre><code>&lt;ListView Name="lvtest" Grid.Row="2" Grid.ColumnSpan="2" Margin="0,20,0,0" 
                ItemsSource="{Binding Content}" &gt;
      &lt;ListView.ItemTemplate&gt;
          &lt;DataTemplate&gt;     
              &lt;StackPanel&gt;                                
                  &lt;WebView Name="contentView" Style="{StaticResource BodyTextStyle}" /&gt;
                  &lt;TextBlock Name="testtxt" Text="{Binding}" Style="{StaticResource BodyTextStyle}" Foreground="GreenYellow"/&gt;
  </code></pre>
  
  <p>In the code behind:</p>
  
  <p><code>this.lvtest</code> is recognised, but:</p>
  
  <p><code>this.contentView</code> and <code>this.testtxt</code> are both not.</p>
  
  <p>I've also tried <code>x:Name</code>.</p>
  
  <p>I'm clearly missing something obvious here, I just can't see what.</p>
  
  <p>EDIT:</p>
  
  <p>To clarify, the textbox control was going to be used to display some formatted text based on the binding, but what I have discovered is that the text is HTML formatted (<a href="http://msdn.microsoft.com/en-us/library/windows/apps/br211380.aspx" rel="nofollow">this</a> suggests using a WebView control).  As far as I can see I need to <code>NavigateToString</code> to use the WebView control, and so can't bind it as such.</p>