KEMBAR78
Use the WebView2CompositionControl in Blazor WPF by mattleibow · Pull Request #31777 · dotnet/maui · GitHub
Skip to content

Conversation

@mattleibow
Copy link
Member

This pull request updates the Blazor WPF integration to use the newer WebView2CompositionControl instead of the older WebView2 control. This change affects multiple files and public APIs, reflecting a platform-wide migration to the new control for improved compatibility and features.

Migration to WebView2CompositionControl:

  • Updated all control type aliases from WebView2 to WebView2CompositionControl in shared source files, WPF-specific files, and event argument definitions (BlazorWebViewInitializedEventArgs.cs, WebView2WebViewManager.cs, BlazorWebView.cs). [1] [2] [3]
  • Changed public API surface in PublicAPI.Unshipped.txt to reflect the new control type, including removal of old getter signatures and addition of new ones for WebView properties.

Project configuration update:

  • Modified the target framework in BlazorWpfApp.csproj to specify windows10.0.17763.0, ensuring compatibility with the new control and platform requirements.

This removes the airspace issues.

This is a breaking change.

Fixes #28063
@Copilot Copilot AI review requested due to automatic review settings September 25, 2025 23:15
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR migrates the Blazor WPF integration from the legacy WebView2 control to the newer WebView2CompositionControl to improve compatibility and features.

  • Updates all type aliases across shared source files to use WebView2CompositionControl
  • Updates public API surface to reflect the new control type
  • Modifies sample project target framework to ensure compatibility with the new control

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/BlazorWebView/src/Wpf/PublicAPI.Unshipped.txt Updates public API definitions to reflect WebView2CompositionControl migration
src/BlazorWebView/src/Wpf/BlazorWebView.cs Changes WebView2Control alias from WebView2 to WebView2CompositionControl
src/BlazorWebView/src/SharedSource/WebView2WebViewManager.cs Updates WebView2Control type alias for WPF platform
src/BlazorWebView/src/SharedSource/BlazorWebViewInitializedEventArgs.cs Changes WebView2Control alias in event args for WPF
src/BlazorWebView/samples/BlazorWpfApp/BlazorWpfApp.csproj Updates target framework to specify Windows 10.0.17763.0 compatibility


<PropertyGroup>
<TargetFrameworks>$(_MauiDotNetTfm)-windows</TargetFrameworks>
<TargetFramework>$(_MauiDotNetTfm)-windows10.0.17763.0</TargetFramework>
Copy link

Copilot AI Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change modifies the target framework from TargetFrameworks (plural) to TargetFramework (singular) and adds a specific Windows version requirement. This could be a breaking change for consumers who were previously able to target multiple frameworks or older Windows versions. Please alert reviewers that this is potentially a breaking change.

Copilot uses AI. Check for mistakes.

@rmarinho
Copy link
Member

/backport to release/10.0.1xx-rc2

@github-actions
Copy link
Contributor

Started backporting to release/10.0.1xx-rc2: https://github.com/dotnet/maui/actions/runs/18038618639

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants