Imbedded wpf textbox does not accept input

Posted by pro3carp3 on Stack Overflow See other posts from Stack Overflow or by pro3carp3
Published on 2010-05-22T05:15:39Z Indexed on 2010/05/22 5:20 UTC
Read the original article Hit count: 154

Filed under:
|
|
|

I put a wpf textbox inside a combobox to allow the user to enter a custom setting. I can read the keypress in the keydown event, but the text in the textbox does not change. What am I missing?

<ComboBoxItem Name="GridSizeCustom">
  <StackPanel Height="30"
              Orientation="Horizontal">
    <TextBlock Text="Grid Size (8 - 200)"
           HorizontalAlignment="Left"
           VerticalAlignment="Top"
           Margin="0"
           />
    <TextBox Name="GridSizeBox"
             KeyDown="test"
             Width="50"
             />
      </StackPanel>
    </ComboBoxItem>

I step through this event handler when I press a key, but no change to the textbox text:

public void test(Object sender, KeyboardEventArgs e) {

int x = 0;

  }

Any help is appreciated. Thanks.

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET