Automation: Why WPF based CEFSharp uses Bitmap for rendering while winforms does not?

128 views
Skip to first unread message

AIJAZ HASSAN

unread,
Apr 11, 2017, 1:43:36 PM4/11/17
to CefSharp
We were able to use automation tool and it was able to identify html objects on Winforms while on WPF it does not since it is rendered as an image. 

My main question is what does Winform CEFSharp uses to render and why WPF not able to use a similar rendering mechanism?  

Raimund Bauer

unread,
Apr 12, 2017, 2:34:59 AM4/12/17
to CefSharp
Good question, but you will have to ask on Gitter or GitHub.

Per Lundberg

unread,
Sep 27, 2017, 3:03:07 PM9/27/17
to CefSharp
Hi,

On Tuesday, April 11, 2017 at 8:43:36 PM UTC+3, AIJAZ HASSAN wrote:
We were able to use automation tool and it was able to identify html objects on Winforms while on WPF it does not since it is rendered as an image. 

My main question is what does Winform CEFSharp uses to render and why WPF not able to use a similar rendering mechanism?  

Allow me to expand on this, since I was involved in the project a few years ago and know a bit about the background here. I know the question was asked a few months ago but I didn't realize that until I had already started writing, and it might be useful to someone reading this later on... :)

WPF is an advanced platform, with support for transparency and many other interesting features. To properly support these features, WPF needs to "own" the windows it takes care of. Otherwise, you will run into so-called "airspace issues": https://blogs.msdn.microsoft.com/dwayneneed/2013/02/26/mitigating-airspace-issues-in-wpf-applications/

So, to _properly_ support WPF, rendering to a bitmap which is then constantly blitted to the WPF surface (which is roughly what CefSharp does) is the only sensible way to do it.

Windows Forms doesn't have these challenges, since it's a much more limited platform, so in that case, we can just tell CEF to render to the HWND of the Windows Forms window.

Best regards,
Per
Reply all
Reply to author
Forward
0 new messages