-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Regression in 11.1 Beta2 and RC1 concerning EmbeddableControlRoot's EmbeddableWindow implementation on Windows #16048
Regression in 11.1 Beta2 and RC1 concerning EmbeddableControlRoot's EmbeddableWindow implementation on Windows #16048
Comments
This line is responsible for attaching embeddable control to the parent: https://github.com/AvaloniaUI/Avalonia/blob/master/src/Windows/Avalonia.Win32.Interoperability/WinForms/WinFormsAvaloniaControlHost.cs#L60 It never really did set CHILD style on parent though, so regression must come from something else. On other hand, this style would make sense anyway. |
@fitdev a PR is welcome if you know how to improve it. |
I know, in fact I was using own implementation of The real cause is that the "embedded window" created by I am not Windows expert by any means, so don't really know which styles and/or extended styles should be set for such a case. But, |
After some more digging, the culprit seems in the WindowImpl.UpdateWindowProperties which unconditionally does this The So, the bottom line is that this gets screwed up in the |
Restore WS_CHILD window style for embedded windows. Should fix: AvaloniaUI#16048
Describe the bug
If Avalonia is hosted inside a Windows app, like WinForms for example, then whenever user interacts with Avalonia's content embedded in the
EmbeddableControlRoot
, the containing app window (i.e. WinForms main window) loses focus.To Reproduce
Just use EmbeddableControlRoot directly or via WinFormsAvaloniaControlHost to see this behavior.
Expected behavior
The containing parent window should not lose focus when user interacts with Avalonia embedded via EmbeddableControlRoot.
Avalonia version
11.1
OS
Windows
Additional context
After some investigation turns out the actual EmbeddableWindow implementation used by EmbeddableControlRoot to create a native Windows window does NOT set
WS_CHILD
style:Once that style is added manually (via, for instance User32's
SetWindowLong
API) everything works fine.So it seems, that the code for creating embedded windows on Windows should be reviewed, especially within the Interop context.
The text was updated successfully, but these errors were encountered: