title: Is it possible to inherit XAML?
body: <p>I have usercontrols which inherit a base class which looks like this:</p>
  
  <p><strong>BasePage.cs:</strong></p>
  
  <pre><code>using System.Windows.Controls;
  
  namespace TestPageManager23434
  {
      public class BasePage : UserControl
      {
          public string ButtonPreviousText { get; set; }
          public string ButtonNextText { get; set; }
  
          protected PageManager pageManager;
  
          public BasePage(PageManager pageManager)
          {
              this.pageManager = pageManager;
          }
      }
  }
  </code></pre>
  
  <p>And the user controls which look like this:</p>
  
  <p><strong>XAML:</strong></p>
  
  <pre><code>&lt;local:BasePage x:Class="TestPageManager23434.Page1"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:local="clr-namespace:TestPageManager23434"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt;
      &lt;StackPanel Background="White" 
               Width="400"
               Height="400"                
                  &gt;
          &lt;TextBlock Text="this is page1"/&gt;
          &lt;TextBlock Text="{Binding Message}"/&gt;
          &lt;Button Content="go to page 2" Click="Button_Click"
                  HorizontalAlignment="Left"
                  Width="200"
                  Height="30"
                  /&gt;
      &lt;/StackPanel&gt;
  &lt;/local:BasePage&gt;
  </code></pre>
  
  <p><strong>Code Behind:</strong></p>
  
  <pre><code>using System.Windows.Controls;
  
  namespace TestPageManager23434
  {
      public partial class Page1 : BasePage
      {
          public string Message { get; set; }
  
          public Page1(PageManager pageManager) : base(pageManager)
          {
              InitializeComponent();
              DataContext = this;
          }
  
          private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
          {
              pageManager.SwitchPage("page2");
          }
      }
  }
  </code></pre>
  
  <p>But now in my XAML portions of my various UserControls I also have <strong>XAML blocks</strong> which I would also like to <strong>inherit</strong> from the base class so that I don't have this block copied in each XAML file:</p>
  
  <pre><code>&lt;StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Left"&gt;
      &lt;Button 
          Content="{Binding ButtonPreviousText}" 
          Width="150"
          Margin="5"
          Click="ButtonPrevious_Click"/&gt;
      &lt;Button 
          Content="{Binding ButtonNextText}" 
          Width="150"
          Click="ButtonNext_Click" Margin="5"/&gt;
  &lt;/StackPanel&gt;
  </code></pre>
  
  <p>But since my base class has no XAML, I see two ways:</p>
  
  <ul>
  <li>create them in code in my base class</li>
  <li>create usercontrols for them</li>
  </ul>
  
  <p><strong>Or is there another way to have this XAML in one location or some way to inherit XAML?</strong></p>