Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WinFormsAvaloniaControlHost blocks access to parent window #16526

Closed
daniel-lerch opened this issue Jul 29, 2024 · 3 comments
Closed

WinFormsAvaloniaControlHost blocks access to parent window #16526

daniel-lerch opened this issue Jul 29, 2024 · 3 comments
Labels

Comments

@daniel-lerch
Copy link
Contributor

Describe the bug

Mouse clicks only work inside of the Avalonia control. Clicking a Windows Forms Button does nothing anymore and even the native window buttons like minimize, maximize and close do not work. Windows Forms seems to get the mouse move information, as hover animations work but the click event seems not to arrive.

Furthermore, when pressing Alt+F4 the Avalonia control closes, instead of this key code being handled by Windows Forms.

To Reproduce

  1. Create an Avalonia project
  2. Create a WinForms project referencing the Avalonia project
  3. Add a WinFormsAvaloniaControlHost to your WinForms project
  4. Add winFormsAvaloniaControlHost1.Content = new MainView { DataContext = new MainViewModel() }; to the constructor
  5. Launch your WinForms application

Expected behavior

When clicking outside of the Avalonia control, clicks should be handled by Windows Forms and perform actions. Furthermore, Alt+F4 should be handled by Windows Forms and close the hosting application (by default).

Avalonia version

11.1.1

OS

Windows

Additional context

This is a regression introduced in 11.1.0. The same code worked with Avalonia 11.0.11 before. The current master branch, i.e. 11.2.999-cibuild0050568-alpha also works.

One more interesting fact: When testing with samples/interop/WindowsInteropTest from this repository at tag 11.1.1, I could not reproduce the click issue but the behavior of Alt+F4 was still wrong. At master, i.e. 78935ba everything was fine again.

@maxkatz6
Copy link
Member

It's likely fixed by #16051

Should be backported to 11.1.2

@daniel-lerch
Copy link
Contributor Author

I can confirm it's fixed by #16051. Backporting it would be great.

@daniel-lerch
Copy link
Contributor Author

This was backported in 11.1.3 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants