title: Add control to custom base page
body: <p>I'm trying to create a custom base page for my WP app. I'm doing this by creating a new <code>cs</code> class file that inherits from <code>PhoneApplicationPage</code> like this:</p>
  
  <pre><code>public class BasePage: PhoneApplicationPage
  {
     //handle common non-visual stuff here
  } 
  </code></pre>
  
  <p>The problem is that I would like to add a control on every page that uses <code>BasePage</code> but BasePage has no <code>LayoutRoot</code> or any visual element that I can attach the control to. Is there a way I can add the same control to all the pages that use BasePage so that I don't have to copy/paste it every time?</p>
  
  <p><strong>Edit</strong>: Adding XAML based on TriggerPin's answer. I've created a new XAML file for my <code>BasePage.cs</code> but this is throwing errors in <code>BasePage.g.cs</code>:
  "MyApp.MainPage already contains a definition for '_contentLoaded'" (and similar message for 'LayoutRoot' and 'InitializeComponent') </p>
  
  <pre><code>&lt;local:BasePage
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
      xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:local="clr-namespace:MyApp.Template"
      x:Class="MyApp.MainPage"
      mc:Ignorable="d"&gt;
  </code></pre>