locked
TextBox控件如何响应CharacterReceived事件?

    Question

  • 我发现TextBox控件只有KeyDown/KeyUp事件,没有CharacterReceived事件。但是在CoreWindow里有。为什么?
    Sunday, March 18, 2012 4:20 AM

Answers

  • 你可以在CoreWindow里,响应CharacterReceived事件,然后调用 FocusManager.GetFocusedElement 方法,获取当前的焦点输入控件,实现你的处理逻辑。

    TextBox是一个XAML控件,没有关联的窗口句柄,所以无法直接响应CharacterReceived事件。


    Best wishes,


    Robin [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Yi Feng Li Wednesday, April 4, 2012 3:19 AM
    Sunday, March 18, 2012 6:15 AM
    Moderator