FluentWPF
FluentWPF copied to clipboard
Incorrect behavior with WindowsFormsHost
There is no way to set solid color background to WindowsFormsHost control with the AcrylicWindow.

Any idea how to fix this?
Hi, @m1024
Thanks for the feedback. I'm not so familiar with interoperability between WPF & WinForms. I'd like to test WindowsFormsHost control. Please show me your code.
Hi, @m1024
Thanks for the feedback. I'm not so familiar with interoperability between WPF & WinForms. I'd like to test WindowsFormsHost control. Please show me your code.
You just should create WinForms UserControl and put it in the xaml in WindowsFormsHost:
<WindowsFormsHost Background="Black" Opacity="1" Grid.Row="1">
<local:UserControl1></local:UserControl1>
</WindowsFormsHost>
Full source code you can see here: https://github.com/m1024/FluentWpfTest
@m1024
Thank you for the information and full source code. I could reproduce it.
I think that it is caused by the airspace issue between WPF and WinForms. If so, it could be limitation of WPF.
The visual of WPF and other platforms can't be layered. (WindowsFormsHost control can't overlay and represents WPF's background.)
Furthermore, the background color of WindowsFormsHost is affected by the WPF Window.
If you use AllowsTransparency="True" or customize Window with WindowChrome property, WindowsFormsHost controls become to have transparent background.
(FluentWPF uses WindowChrome attached property internally.)
This is why the WindowsFormsHost controls become transparent.
I'm investigating this issue and finding a workaround. Please wait for a while.