locked
Wrapped textbox + keyboard event handler = broken textbox RRS feed

  • Question

  • I get major visual glitching with the following textbox configuration. When the text in the textbox passes one line width, the text scrolls to the left out of view, among other things. Control+A to select all will generally redraw stuff correctly. This happens with both KeyDown and KeyUp events and happens even if I set e.Handled to false.

     The defect occurs when typing into the textbox.

    I've tested on FF3 and IE7 on Vista.

    <TextBox TextWrapping="Wrap" Width="300" Height="300" KeyDown="TextBox_KeyDown" />

    private void TextBox_KeyDown(object sender, KeyEventArgs e)
    {
    e.Handled = false; // No matter whether I set this to false or true.
    }

    Monday, October 27, 2008 8:37 AM

Answers

  • Can you do this quick test to narrow this down?

    If you subscribe to the KeyDown event handler in code (as oppossed to subscribing in XAML), does that change the behavior?

    Thanks, Stefan Wick

    Monday, October 27, 2008 10:47 AM

All replies

  • Can you do this quick test to narrow this down?

    If you subscribe to the KeyDown event handler in code (as oppossed to subscribing in XAML), does that change the behavior?

    Thanks, Stefan Wick

    Monday, October 27, 2008 10:47 AM
  • Yes, the defect does not occur if I attach the event handler in code.

    Tuesday, October 28, 2008 1:04 AM
  • OK, thanks for confirming. You are hitting a known bug with this scenario. The workaround is to attach the event handler in code.

    Thanks, Stefan Wick

    Microsoft Silverlight

    Tuesday, October 28, 2008 1:15 AM