Hi I have my custom control which looks like that
<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}">
<UserControl.Resources>
<ResourceDictionary Source="TextBoxStyles.xaml"/>
</UserControl.Resources>
<DockPanel LastChildFill="True" Style="{StaticResource PanelStyle}">
<Label DockPanel.Dock="Top" Content="{Binding Path=_Code}" HorizontalAlignment="Stretch" Name="label1" Height="25" VerticalAlignment="Top" Style="{StaticResource LabelStyle}" ></Label>
<TextBox Name="txtBox" Style="{StaticResource DefaultStyle}" >
<TextBox.Text>
<Binding Path="_Name">
</Binding>
</TextBox.Text>
</TextBox>
</DockPanel>
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 ?
I gave a try to this code
<Style TargetType="{x:Type UserControl}" x:Key="BlockStyle" >
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Ellipse
x:Name="Border"
Stroke="#FF393785"
StrokeThickness="2"
Fill="Transparent"
>
</Ellipse>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
However when I use this style in my control, all elements (textbox and label etc) are coverd by this style.