title: Metro XAML custom control cannot be accessed from code behind
body: <p>Trying to use the solution to <a href="https://stackoverflow.com/questions/10490709/righttapped-not-fired-on-metro-listviewitem-if-listview-in-other-than-none-sel">this</a> question gives me a weird problem. (Replicated here for convenience)</p>
  
  <p>This is a solution for an issue with <code>ListView</code> swallowing the right-click event and preventing the AppBar from opening - A class which inherits <code>ListView</code> and overrides the <code>OnRightTapped</code> event of <code>ListViewItem</code>:</p>
  
  <pre><code>public class MyListView : ListView
  {
      protected override DependencyObject GetContainerForItemOverride()
      {
          return new MyListViewItem();
      }
  }
  
  public class MyListViewItem : ListViewItem
  {
      protected override void OnRightTapped(Windows.UI.Xaml.Input.RightTappedRoutedEventArgs e)
      {
          base.OnRightTapped(e);
          e.Handled = false; // Stop 'swallowing' the event
      }
  }
  
  &lt;CustomControls:MyListView
      x:Name="ItemsList"
      ...
      SelectionMode="Single"
      RightTapped="MyListView_RightTapped"&gt;
  &lt;/CustomControls:MyListView&gt;
  </code></pre>
  
  <p>I have implemented a custom control as specified, in a new namespace called CustomControls, exactly as described. I've added that namespace to MainPage.xaml </p>
  
  <pre><code>xmlns:CustomControls="using:CustomControls"
  </code></pre>
  
  <p>When I then try and reference 'ItemsList' in code behind, I get a compile error </p>
  
  <pre><code>The name 'ItemsList' does not exist in the current context
  </code></pre>
  
  <p>I've tried building, rebuilding, cleaning the solution, closing and reopening the solution, putting the classes under the main project namespace, all to no avail. </p>
  
  <p><strong>To summarise, MainPage.cs cannot see a Custom Control on MainPage.xaml</strong></p>
  
  <p>UPDATE 2: Reworded the question to remove irrelevant issues. I've also changed the title to reflect the real issue. </p>