WPF Usercontrol with textboxes
        Posted  
        
            by benPearce
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by benPearce
        
        
        
        Published on 2009-07-10T06:41:21Z
        Indexed on 
            2010/05/10
            22:04 UTC
        
        
        Read the original article
        Hit count: 317
        
I have a WPF user control with a number of textboxes, this is hosted on a WPF window. The textboxes are not currently bound but I cannot type into any of them.
I have put a breakpoint in the KeyDown event of one of the textboxes and it hits it fine and I can see the key I pressed.
The textboxes are declared as 
 <TextBox Grid.Row="3"
          Grid.Column="4"
          x:Name="PostcodeSearch"
          Style="{StaticResource SearchTextBox}"
          KeyDown="PostcodeSearch_KeyDown"/>
The style is implemented as
<Style x:Key="SearchTextBox"
       TargetType="{x:Type TextBox}">
        <Setter Property="Control.Margin" Value="2"/>
        <Setter Property="Height" Value="20"/>
        <Setter Property="Width" Value="140"/>
        <Setter Property="HorizontalAlignment" Value="Left"/>
    </Style>
I am hoping I have overlooked something obvious.
EDIT: I only added the KeyDown and KeyUp events just to prove that the keys presses were getting through. I do not have any custom functionality.
© Stack Overflow or respective owner