title: Access XAML object from code
body: <p>I created a UserControl in WPF:</p>
  
  <p>In Xaml:</p>
  
  <pre><code>&lt;UserControl x:Class="OutlookPanel.MailRelation"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      Height="300" Width="300"
      xmlns:graph="clr-namespace:MyPanel"
  &gt;
   &lt;DockPanel&gt;
  &lt;graph:Graph Name="theGraph" NodesBindingPath="ChildNodes"
                 NodeTemplateSelector="{StaticResource nodeTemplateSelector}"&gt;
  ..
   &lt;/DockPanel&gt;
  &lt;/UserControl&gt;
  </code></pre>
  
  <p>I cs:</p>
  
  <pre><code>object theThing = e.Parameter;
                      ((MailRelation)sender).theGraph.CenterObject = theThing;
  </code></pre>
  
  <p>This last sentence does not work as theGraph is not accessible.
  Any idea why i can access theGraph ?</p>
  
  <p>Thanks</p>
  
  <p>John</p>