ElementHost / Aero Glass Rendering Problem -- Description and Fix

    General discussion


    When using the ElementHost under Aero Glass on Vista we encountered a problem where the ElementHost would show bitmaps from other areas of the screen. It almost looked like a rendering corruption via DWM.EXE?


    This was easily fixed by manually resizing the window, or manually invalidating the ElementHost window via an Alt+Tab (x2).


    If we deactivated Aero Glass, and went down to Windows Standard theme (i.e. deactivated Aero Glass), then the issue no longer occurred.


    The in code fix for this was a complete hack:




    Once the size was forced to shift then the proper paint procedure for the ElementHost kicked in and fixed this issue under Aero Glass.


    For your future WPF scenario checks:

    1) If you encounter a core window / rendering problem on Windows Vista try activating and deactivating Aero Glass.

    This will in turn remove / add the functionality from the Desktop Window Manager into your rendering cycle.

    2) If you have weird issues with WPF rendering, especially via ElementHost you might have to do things that aren't very clean to fix drawing / invalidation issues.

    3) Always run your WPF views in the following scenarios to fully test them. Due to core changes in how windows are presented to the video card, you never know when you might have an issue:

    a) Windows XP (all Tiers of graphics)

    b) Windows XP -- Minimal Theme (all Tiers of graphics)

    c) Windows Vista - Aero Glass (all Tiers of Graphics)

    d) Windows Vista - Standard Windows (all Tiers of Graphics)


    Good luck and good rendering,



    Monday, March 10, 2008 8:47 PM

All replies

  • I will change the issue type of this post to "Comment" since you are not asking questions but provide helpful information and tips.

    Thanks for sharing Dan
    Wednesday, March 12, 2008 4:18 AM