How to create a KeyEventArgs object in WPF ( related to a SO answer )

前端 未结 5 1764
野趣味
野趣味 2020-12-29 04:39

I\'ve found this answer which look like what I need:

How can I programmatically generate keypress events in C#?

Except for the fact I can\'t create an insta

5条回答
  •  一整个雨季
    2020-12-29 04:57

    var kea = new KeyEventArgs(
        Keyboard.PrimaryDevice,
        new HwndSource(0, 0, 0, 0, 0, "", IntPtr.Zero),
        0,
        Key.Enter)
        {
            RoutedEvent = UIElement.KeyUpEvent
        };
    

提交回复
热议问题