I’m trying to figure out why the control does not honor ZIndex.
Example 1 – which works fine
<Canvas> <Rectangle Canvas.ZIndex='1' Height='400' Width='600' Fill='Yellow'/> <Rectangle Canvas.ZIndex='2' Height='100' Width='100' Fill='Red'/> </Canvas>
Example 2 – which does not work
<Canvas> <WebBrowser Canvas.ZIndex='1' Height='400' Width='600' Source='http://www.stackoverflow.com'/> <Rectangle Canvas.ZIndex='2' Height='100' Width='100' Fill='Red'/> </Canvas>
Thanks, — Ed
Unfortunately this is because the WebBrowser control is a wrapper around the Internet Explorer COM control. This means that it gets its own HWND and does not allow WPF to draw anything over it. It has the same restrictions as hosting any other Win32 or WinForms control in WPF.
MSDN has more information about WPF/Win32 interop.