title: WPF - Can I stop UserControl exposing its named child elements?
body: <p>This is a bit of a noob question but I've just realised that if i create a UserControl and choose to name some of its child elements a la - </p>
  
  <pre><code>&lt;UserControl x:Class="UserControls.uControl"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  Height="300" Width="300"&gt;
  &lt;Grid x:Name="maingrid"&gt;
  
  &lt;/Grid&gt;
  </code></pre>
  
  <p></p>
  
  <p>then i can reference the named elements in the code-behind of the consuming XAML.  So for the example above i could write</p>
  
  <pre><code>uControl.mainGrid = new Grid();
  </code></pre>
  
  <p>I'm curious as to why this is the case and more importantly, how i can safely encapsulate these controls.</p>
  
  <p>As usual, ANY help would be really appreciated.</p>