I'm couple days into learning C# and I just ran into a weird problem. I have a TextBox in WPF application, that normally works without any problem, but after I apply a custom template to it in XAML, it stops returning text value. It is always empty string.
My template in XAML:
<ControlTemplate x:Key="TextBoxBaseControlTemplate" TargetType="{x:Type TextBoxBase}">
<Border x:Name="Bd" BorderBrush="DarkGray" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="4,4,4,4">
<TextBox Background="#353535" Foreground="White"/>
</Border>
</ControlTemplate>
My TextBox in XAML:
<TextBox x:Name="TextBox" Template="{StaticResource TextBoxBaseControlTemplate}" Foreground="White" BorderThickness="1" BorderBrush="DarkGray" HorizontalAlignment="Stretch" Height="23" Margin="53,0,105,15" TextWrapping="Wrap" Text="Enter city" VerticalAlignment="Bottom" GotFocus="TextBox_GotFocus" KeyDown="TextBox_KeyDown"/>
How can I fix this?