Hi,
I tried to create a Custom Control in WPF and for some reason the layout is empty.
My Custom Control is a TextBox.
VS generated this for me:
public class AutoCompleteTextBox : TextBox
{
static AutoCompleteTextBox()
{ DefaultStyleKeyProperty.OverrideMetadata(typeof(AutoCompleteTextBox), new FrameworkPropertyMetadata(typeof(AutoCompleteTextBox)));
}
}
I have found that the above underlined line is what causes the layout to be empty, but deleting it means my control is just a regular text box.
This is my Generic.xml:
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:TTSoftware_Prod1" xmlns:sb="clr-namespace:TTSoftware_Prod1.UserControls.SearchBox"><Style TargetType="{x:Type sb:AutoCompleteTextBox}"><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="{x:Type sb:AutoCompleteTextBox}"><Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"></Border></ControlTemplate></Setter.Value></Setter></Style></ResourceDictionary>
What am I missing? I'm sure it's something stupid but I have been at it for 5 hours.
Thanks in advance!