title: Refer to a xaml element in xaml.cs file in Windows 8.1 project
body: <p>Hello I am currently learning Windows 8.1 development with Visual Studio 2015.<br>
  <strong>How can I refer to a xaml element in a .xaml file from the associated .xaml.cs file</strong>.<br><br>
  MainPage.xaml file:</p>
  
  <pre><code>&lt;Page
  x:Class="project.MainPage"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:local="using:project"
  xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  mc:Ignorable="d"&gt;
  
          &lt;HubSection Width="600" x:Uid="Section1Header" Header="Map"&gt;
          &lt;DataTemplate&gt;
              &lt;Grid&gt;
                  &lt;Button x:Name="mapButton" Content="Find my location"/&gt;
              &lt;/Grid&gt;
          &lt;/DataTemplate&gt;
      &lt;/HubSection&gt;
  //...
  </code></pre>
  
  <p>MainPage.xaml.cs file:</p>
  
  <pre><code>namespace project
  {
      public sealed partial class MainPage : Page
      {
          public MainPage()
          {
              this.InitializeComponent();
              mapButton.Click += mapButton_Click;
          }
  }
  </code></pre>
  
  <p>On <code>mapButton</code> I get the error : The name 'mapButton' doesn't exist in the actual context.<br>
  I thought <code>x:Name</code> was a way to give a name with wich I can access the xaml element from the .xaml.cs file.</p>