title: WPF rhombus shape custom control
body: <p>I have my custom control which looks like that </p>
  
  <pre><code>&lt;UserControl BorderBrush="#A9C2DE" HorizontalAlignment="Left" x:Class="Block"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      Height="86" Width="151"  ToolTip="{DynamicResource BasicTooltip}"&gt;
  &lt;UserControl.Resources&gt;
      &lt;ResourceDictionary Source="TextBoxStyles.xaml"/&gt;
  &lt;/UserControl.Resources&gt;
  &lt;DockPanel LastChildFill="True" Style="{StaticResource PanelStyle}"&gt;
      &lt;Label DockPanel.Dock="Top" Content="{Binding Path=_Code}" HorizontalAlignment="Stretch"  Name="label1" Height="25" VerticalAlignment="Top" Style="{StaticResource LabelStyle}" &gt;&lt;/Label&gt;
      &lt;TextBox  Name="txtBox"  Style="{StaticResource DefaultStyle}" &gt;
          &lt;TextBox.Text&gt;
              &lt;Binding Path="_Name"&gt;
  
              &lt;/Binding&gt;
          &lt;/TextBox.Text&gt;
      &lt;/TextBox&gt;
  
  &lt;/DockPanel&gt;
  </code></pre>
  
  <p>
  So as You can see this control consist of a DockPanel where I placed label and textbox. In code I added some event to an operation on label and textbox mentioned above. This control has a basic shape of rectangle. However today I found out that it would be better for this control to have shape of rhombus or sth more sophisticated then casual rectangle.
  Is it possible to give my control different shape, keep all functionality (all events I wrote in code file) and keep the content (textbox and label) intanct ?</p>
  
  <p>I gave a try to this code</p>
  
  <pre><code> &lt;Style TargetType="{x:Type UserControl}" x:Key="BlockStyle" &gt;
          &lt;Setter Property="Template"&gt;
              &lt;Setter.Value&gt;
                  &lt;ControlTemplate&gt;
  
                      &lt;Ellipse  
                              x:Name="Border"  
                              Stroke="#FF393785"  
                              StrokeThickness="2" 
                              Fill="Transparent"
                              &gt;
  
                      &lt;/Ellipse&gt;
              &lt;/ControlTemplate&gt;
              &lt;/Setter.Value&gt;
  
          &lt;/Setter&gt;
  &lt;/Style&gt;
  </code></pre>
  
  <p>However when I use this style in my control, all elements (textbox and label etc) are coverd by this style.</p>