Skip to content

[Problem/Bug]: WebView2CompositionControl does not repaint correctly when wrapped in a WPF LayoutTransform (ScaleTransform) #5400

@dipsgin

Description

@dipsgin

What happened?

Description
When using WebView2CompositionControl inside a WPF application and wrapping it in a LayoutTransform (such as ScaleTransform for zooming), the WebView content sometimes becomes stale or only partially rendered.

The issue occurs intermittently — after scaling or layout changes, the web content does not visually update until the user interacts with it (e.g., moving the mouse over an element, clicking, or switching window focus).

It appears that the DirectComposition layer used internally by WebView2CompositionControl is not invalidated or redrawn when the WPF layout transform is applied.

Expected behavior
WebView2CompositionControl should repaint its DirectComposition surface when its layout is transformed by WPF, so that the visible content remains correct and up to date.

Actual behavior
The rendered content often becomes stale until another UI interaction (like mouse hover, focus change, or window activation) triggers a new frame composition.
This does not happen with the standard HWND-based WebView2 control.

Impact
This breaks scenarios where apps apply application-level zoom or scaling using LayoutTransform (common for WPF apps that support per-monitor DPI scaling or internal zoom).
The only workaround is to avoid LayoutTransform entirely, which removes flexibility in layout and zoom handling.

Importance

Important. My app's user experience is significantly compromised.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

141.0.3537.71

SDK Version

1.0.3065.39

Framework

WPF

Operating System

Windows 11

OS Version

No response

Repro steps

  1. Create a simple WPF window with a WebView2CompositionControl.
  2. Wrap the control in a LayoutTransform using a ScaleTransform.
  3. Load a webpage
  4. Change the ScaleX and ScaleY dynamically (simulating zooming with Ctrl+Mouse wheel).
  5. Observe that the content sometimes fails to repaint properly — elements appear blurry, frozen, or misaligned.
  6. Moving the mouse over the page or switching focus forces the content to refresh correctly.

Repros in Edge Browser

No, issue does not reproduce in the corresponding Edge version

Regression

No, this never worked

Last working version (if regression)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions