title: Why can you inherit a class over project boundaries, but not its attached XAML?
body: <p>(this question is a refinement of <a href="https://stackoverflow.com/questions/1493572/why-do-i-get-a-xamlparseexception-when-i-inherit-a-custom-usercontrol-in-another">my other question on this topic</a> which was a bit complicated but I really want to understand why this doesn't work so <strong>here's a more straight-forward example</strong>)</p>
  
  <p><strong>WHAT I WANT TO DO: create a simple class (no XAML) in one project which inherits a WPF UserControl (with XAML) in another project.</strong></p>
  
  <p>Here is my inheriting class in my main project:</p>
  
  <p><strong>EmployeeEditor.cs:</strong></p>
  
  <pre><code>using System.Windows.Controls;
  using System.Windows;
  using System.Windows.Media;
  using CoreApp;
  
  namespace TestInheritUserControl234
  {
      class EmployeeEditor : BaseEditor
      {
          public EmployeeEditor()
          {
              TextBlock tb = new TextBlock();
              tb.Text = "This was added in EmployeeEditor";
              tb.Foreground = new SolidColorBrush(Colors.Blue);
              EditorContent.Children.Add(tb);
          }
      }
  }
  </code></pre>
  
  <p>And here is my base class in my second project, notice it has <strong>x:Name="EditorContent"</strong>:</p>
  
  <p><strong>BaseEditor.xaml:</strong></p>
  
  <pre><code>&lt;UserControl x:Class="CoreApp.BaseEditor"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt;
      &lt;StackPanel x:Name="EditorContent" Margin="5"&gt;
          &lt;TextBlock x:Name="TheMessage" Text="This was added in BaseEditor XAML."/&gt;
      &lt;/StackPanel&gt;
  &lt;/UserControl&gt;
  </code></pre>
  
  <p><strong>BaseEditor.xaml.cs:</strong></p>
  
  <pre><code>using System.Windows.Controls;
  namespace CoreApp
  {
      public partial class BaseEditor : UserControl
      {
          public BaseEditor()
          {
              InitializeComponent();
  
              TextBlock tb = new TextBlock();
              tb.Text = "This was added in BaseEditor code-behind.";
              EditorContent.Children.Add(tb);
          }
      }
  }
  </code></pre>
  
  <p>The problem is when this is run, I get the error <strong>The name 'EditorContent' does not exist in the current context</strong>.</p>
  
  <p>However, if all classes are in <strong>one project</strong>, it runs fine.</p>
  
  <p><strong>Why would it be that you can inherit a class over project boundaries, but not its  attached XAML?</strong></p>