WPF control inside transparent winform not showing

I create a simple UserControl WPF (any control will do) and paste it into Winform (using ElementHost). It works great. The WPF control is built into WinForm, and when WinForm moves around the WPF control, it moves with it, like the WinForm control does. When I change WinForm to transparent by setting the TranparencyKey to the same value as BackColor, there are some problems: - The WPF control is not displayed - instead, a black rectangle is displayed in its place. - If WinForm moves around the screen, then the WPF control appears in its original place - as if it were covered by WinForm.

Changing the properties of an ElementHost element (for example, BackColorTransparent) did not change the behavior. Installing both BackColor and TransparencyKey WinForm on Black got rid of the black rectangle problem, but when moving WinForm, the WPF control remained in its original place.

Please also note that these problems occur in Windows XP SP3 (this is our target OS), but not in Windows 2003. (We did not check Vista and Windows 7).

Any ideas on how to have transparent Winform with a WPF control inside and still get normal behavior?

+3
source share
1 answer

WPF? , , . UserControl , .

0

Source: https://habr.com/ru/post/1726961/


All Articles