title: Creating Adorner Control in WPF
body: <p>I'm Using VB.Net 2012 With WPF</p>
  
  <p>Code</p>
  
  <pre class="lang-vb prettyprint-override"><code>Public Class UserControl1
  Inherits Adorner
  
  Sub New(AdornedElement As UIElement)
      MyBase.New(AdornedElement)
      'Err Found Here
  End Sub
  
  Private Sub Button_Click(sender As Object, e As RoutedEventArgs)
  
  End Sub
  End Class
  </code></pre>
  
  <p><b>Error : Base class 'System.Windows.Controls.UserControl' specified for class 'UserControl1' cannot be different from the base class 'System.Windows.Documents.Adorner' of one of its other partial types.</b></p>
  
  <p>please help</p>
  
  <p>.
  .
  .
  .
  <i><b>Edit : Added XAML Code of UserControl</b></i></p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;UserControl x:Class="UserControl1"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
           mc:Ignorable="d" 
           d:DesignHeight="300" d:DesignWidth="300"&gt;
  &lt;Grid&gt;
      &lt;Grid.RowDefinitions&gt;
          &lt;RowDefinition Height="Auto"/&gt;
          &lt;RowDefinition Height="Auto"/&gt;
      &lt;/Grid.RowDefinitions&gt;
  
  
      &lt;TextBlock Text=" This is Child Control " HorizontalAlignment="Center" VerticalAlignment="Center"/&gt;
      &lt;Button Grid.Row="1" Content="Close Child Control " HorizontalAlignment="Center" VerticalAlignment="Center" Click="Button_Click"/&gt;
  &lt;/Grid&gt;
  &lt;/UserControl&gt;
  </code></pre>
  
  <p><b>Edit : Errs. add on Changing UserControl to Adorner</b></p>
  
  <pre><code>Error   6   Base class 'System.Windows.Controls.UserControl' specified for class 'UserControl1' cannot be different from the base class 'System.Windows.Documents.Adorner' of one of its other partial types.   D:\Data - 2012\Temp\WPF Adorners\WPF Adorners\obj\Debug\UserControl1.g.i.vb 42  14  WPF Adorners
  Error   1   Cannot add content to an object of type "Adorner".  D:\Data - 2012\Temp\WPF Adorners\WPF Adorners\UserControl1.xaml 8   5   WPF Adorners
  Error   2   Type 'Adorner' is not usable as an object element because it is not public or does not define a public parameterless constructor or a type converter.   D:\Data - 2012\Temp\WPF Adorners\WPF Adorners\UserControl1.xaml 1   2   WPF Adorners
  Error   3   The type 'Adorner' does not support direct content. D:\Data - 2012\Temp\WPF Adorners\WPF Adorners\UserControl1.xaml 8   5   WPF Adorners
  Error   4   Cannot add content to object of type 'System.Windows.Documents.Adorner'. Line 8 Position 6. D:\Data - 2012\Temp\WPF Adorners\WPF Adorners\UserControl1.xaml 8   6   WPF Adorners
  </code></pre>