-
-
Notifications
You must be signed in to change notification settings - Fork 343
Description
Most input aside from Key.Tab on Eto.Platform.WPF is not being picked up by the Form.KeyUp event when upgrading from 2.9.0 to 2.10+.
Cannot reproduce the same issue on GTK with Eto 2.10+. I have not tested other platforms.
Seems to have been caused by #2757 where when the WpfFrameworkElement switched to the overridable KeyEventControl, the WpfWindow overrided the property from the default Control value to main.
I tested Eto.Forms from the "develop" branch by hooking up the source code to my host project. Switching the override from main back to Control in WpfWindow fixed the regression on my end, so this may be the solution.
However, I am not sure what reasoning was made regarding overriding WpfWindow<>.KeyEventControl to main so I felt it was important to consult with the project first before trying to push a PR myself.
Reproduction Steps
- Run the following code on Eto.Platform.Wpf (compare 2.9.0 vs 2.10.2):
class MyForm : Form
{
Label label;
public MyForm()
{
Title = "My Cross-Platform App";
ClientSize = new Eto.Drawing.Size(200, 200);
label = new Label { Text = "Hello World!" };
Content = label;
this.KeyUp += OnKeyUp;
}
private void OnKeyUp(object s, KeyEventArgs e)
{
if (e.Modifiers == (Keys.Control | Keys.Shift))
{
label.Text = "Ctrl+Shift+" + e.Key;
}
else if (e.Modifiers == Keys.Control)
{
label.Text = "Ctrl+" + e.Key;
}
else
{
label.Text = e.Key.ToString();
}
}
}
[STAThread]
public static void Main(string[] args)
{
new Application(Eto.Platforms.Wpf).Run(new MyForm());
}- Type in any keyboard input, including with modifiers, e.g. Ctrl+Shift+O, Ctrl+O, O, etc.
Observe:
- <=2.9.0: Label text changes to keyboard input.
- >=2.10.0: No changes occur.
Expected behavior:
Label should change to what keyboard input has been "KeyUp'd" like how <=2.9.0 behaved.
Specs:
Windows 10, 64 Bit