Repository navigation
feat(WebView2): add Extensions for providing attached properties that can be used to avoid code behind in Mvux using Apps - #21474
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the WebView2 control by adding missing API features and fixing event handling issues. It introduces the DocumentTitle and IsNavigating properties to enable data binding scenarios and improves the DocumentTitleChanged event to properly pass the title value instead of null.
- Adds
DocumentTitleandIsNavigatingdependency properties for better data binding support - Fixes
DocumentTitleChangedevent to pass actual title value instead of hardcoded null - Improves XML documentation across the WebView2 API surface
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| WebView2.cs | Adds event handler registration and navigation state tracking logic |
| WebView2.Properties.cs | Defines new dependency properties and events with proper documentation |
| UnoWKWebView.iOSmacOS.cs | Updates document title change handling to pass actual title value |
| NativeWebView.wasm.cs | Updates document title change handling to pass actual title value |
| HtmlWebViewElement.wasm.cs | Updates document title change handling to pass actual title value |
| NativeWebViewWrapper.Android.cs | Updates document title change handling and fixes comment typo |
| CoreWebView2.cs | Updates event raising method signature and adds comprehensive documentation |
| CoreWebView2.Properties.cs | Fixes grammar in XML documentation comments |
|
If the changes are okay, I could then add the added DependencyProperty to the Uno specifics Docs, but would eitherway plan to create a CommunityTutorial about this for what I did on my app. |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21474/wasm-skia-net9/index.html |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21474/docs/index.html |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21474/wasm-skia-net9/index.html |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21474/docs/index.html |
|
|
|
Hey @Xiaoy312 do you or someone else of the team maybe could check this out? Maybe we could add those things right into the WebView2? For the DocumentTitle this is already existing on the normal "old" WebView control (and many other things too👀 we dont have on the new one like the HttpMessage Navigation action) but not on the 2 one that we are recommended to use. So maybe we could get this also added on the 2? 🥹 |
| /// <summary> | ||
| /// Occurs when the title for the current top-level document changes. | ||
| /// </summary> | ||
| public event TypedEventHandler<WebView2, object> DocumentTitleChanged; |
There was a problem hiding this comment.
Since this a new property, we'll now need a runtime test that provides a way to validate that this property is properly populated.
You can create one in
.If you've never created runtime tests, make sure to review our documentation on the topic.
There was a problem hiding this comment.
Okay, but of you readed the OP above, you might have seen that one of the test projects (the UI test project with Wasm ending) does state "Not Compartible" and VS2022 does not succeed to even load that project which normally comes before writing, building or running a test.
I pointed that issue on the contribution channel on discord and Martin did even comment on that, that its a good finding, so I would guess its valid...
Could you eventually check on this and let me know how to proceed on that?
Another point: The wasm sampleapp ci/cd-build here does also not succeed here even on GH while I did so far not edit it at all.
Is that normal? If it doesn't succeed before I add a test, i would expect it to fail afterwards too 🤔
One other question to the DocumentTitleChanged Typed Event handler:
I do and did see that its argument type is object which is why I set the Copilot review comments about that to solved (fit its instructions to the implemented view API 's that we do not change those signatures?)
but there was no information about what they meaning us to find in there. I would assume from the Naming, that we expect it to return us the new Document title, but I am not completely sure if it is.
Do we have any way to check this?
There was a problem hiding this comment.
Okay, but of you readed the OP above, you might have seen that one of the test projects (the UI test project with Wasm ending) does state "Not Compartible" and VS2022 does not succeed to even load that project which normally comes before writing, building or running a test.
I pointed that issue on the contribution channel on discord and Martin did even comment on that, that its a good finding, so I would guess its valid...
This is unrelated to the change you're making, please don't mix up the threads :)
Another point: The wasm sampleapp ci/cd-build here does also not succeed here even on GH while I did so far not edit it at all.
No problem about this, make sure to make the runtime test first, the rest will fall into place.
One other question to the DocumentTitleChanged Typed Event handler:
I do and did see that its argument type is object which is why I set the Copilot review comments about that to solved (fit its instructions to the implemented view API 's that we do not change those signatures?)
but there was no information about what they meaning us to find in there. I would assume from the Naming, that we expect it to return us the new Document title, but I am not completely sure if it is.
Do we have any way to check this?
Don't mind the copilot reports, it cannot know about the right APIs.
There was a problem hiding this comment.
@jeromelaban Dropped the WebView2 Type API changes, only xml docs updates (see updated OP) there
Do you want me to add the Tests to the Attached Property Definition then still in the Given_WebView2 Test file or rather create another seperate test file for this in this Project?
There was a problem hiding this comment.
@jeromelaban I wasn't able to find an Attached Property Extension test so far, which I could take as sample/template for this and Copilot suggests all the time to create another and another Helper - Host Object while I would prefer to validate the test mainly using xaml, as this should be the target usage and because of I have no idea how to access a DP for a Control via codebehind 😅
Do you maybe have a lookup you know of and I could check out for this?
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21474/docs/index.html |
|
|
|
@MartinZikmund could you enqueue this for review ready list? Would not know how I could make it better with my limited knowledge in attached properties 😅, but maybe the team has after finishing the conf😁 Thanks! 👍 |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21474/docs/index.html |
|
|
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21474/docs/index.html |
|
|
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21474/docs/index.html |
… Event to avoid memory leaks
…d Event to avoid memory leaks
|
|
70998a5 to
8541719
Compare
…lers to improve clarity - Referencing code names with xml tags provides build in lookup capability - adds notes regarding the DocumentTitleChanged event arguments which are expected to always be null - adds Remarks to the target usage of the Event Handler Events
|
|
8541719 to
a2acdb1
Compare
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21474/docs/index.html |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21474/wasm-skia-net9/index.html |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21474/wasm-skia-net9/index.html |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21474/docs/index.html |
|
|
|
Using the suggested Event Subscription from Does not even enter the |
|
@Jen-Uno WebView2 is available for all Targets if I read the docs wrong, but seems like your actions-bot did remove some target tags? |
|
@MartinZikmund could you take a look? |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| private static void OnIsNavigatingChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) | ||
| { | ||
| if (sender is not WebView2 control) | ||
| { | ||
| throw new InvalidOperationException("The attached property 'IsNavigating' can only be applied to a WebView2 control."); | ||
| } | ||
|
|
||
| // Always remove previous event handlers to prevent duplicate subscriptions | ||
| control.NavigationStarting -= OnNavigationStarting; | ||
| control.NavigationCompleted -= OnNavigationCompleted; | ||
| control.Unloaded -= OnControlUnloaded; | ||
|
|
||
| // Only subscribe if the new value is true | ||
| if (e.NewValue is bool isEnabled && isEnabled) | ||
| { | ||
| control.NavigationStarting += OnNavigationStarting; | ||
| control.NavigationCompleted += OnNavigationCompleted; | ||
| control.Unloaded += OnControlUnloaded; | ||
| } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Handles the <see cref="WebView2.Unloaded"/> event for the attached <see cref="WebView2"/> control and removes any event subscriptions: | ||
| /// <list type="bullet"> | ||
| /// <item><see cref="WebView2.NavigationStarting"/></item> | ||
| /// <item><see cref="WebView2.NavigationCompleted"/></item> | ||
| /// <item><see cref="CoreWebView2.DocumentTitleChanged"/></item> | ||
| /// </list> | ||
| /// </summary> | ||
| /// <param name="sender">The <see cref="WebView2"/> control that was unloaded.</param> | ||
| /// <param name="e"> The <see cref="RoutedEventArgs"/> event data.</param> | ||
| private static void OnControlUnloaded(object sender, RoutedEventArgs e) | ||
| { | ||
| if (sender is WebView2 control) | ||
| { | ||
| control.NavigationStarting -= OnNavigationStarting; | ||
| control.NavigationCompleted -= OnNavigationCompleted; | ||
| control.Unloaded -= OnControlUnloaded; | ||
|
|
||
| if (control.CoreWebView2 is not null) | ||
| { | ||
| control.CoreWebView2.DocumentTitleChanged -= OnCoreDocumentTitleChanged; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| private static void OnNavigationStarting(WebView2 sender, CoreWebView2NavigationStartingEventArgs args) | ||
| => SetIsNavigating(sender, true); | ||
|
|
||
| private static void OnNavigationCompleted(WebView2 sender, CoreWebView2NavigationCompletedEventArgs args) | ||
| => SetIsNavigating(sender, false); |
There was a problem hiding this comment.
IsNavigatingProperty is being used both as the switch to subscribe/unsubscribe and as the state updated by navigation events (OnNavigationStarting/OnNavigationCompleted call SetIsNavigating). This causes the callback to remove handlers on navigation completion (when it sets the value to false), so subsequent navigations won't be tracked, and it also churns subscriptions on every state update. Consider splitting this into two attached properties (e.g., TrackIsNavigating/IsNavigating) or using a separate internal attached property to hold the tracking flag while IsNavigating is updated without triggering subscription logic.
| public static DependencyProperty DocumentTitleProperty { [DynamicDependency(nameof(GetDocumentTitle))] get; } = DependencyProperty.RegisterAttached( | ||
| "DocumentTitle", | ||
| typeof(string), | ||
| typeof(WebView2Extensions), | ||
| new PropertyMetadata(string.Empty, OnDocumentTitleChanged)); | ||
|
|
||
| /// <summary> | ||
| /// Gets the value of the <see cref="DocumentTitleProperty">DocumentTitle Attached Property</see> for the specified <see cref="DependencyObject"/>. | ||
| /// </summary> | ||
| /// <param name="obj">The object from which to get the property value.</param> | ||
| /// <returns>The document title of the WebView2 control.</returns> | ||
| [DynamicDependency(nameof(SetDocumentTitle))] | ||
| public static string GetDocumentTitle(DependencyObject obj) => (string)(obj.GetValue(DocumentTitleProperty) ?? string.Empty); | ||
|
|
||
| /// <summary> | ||
| /// Sets the value of the <see cref="DocumentTitleProperty">DocumentTitle Attached Property</see> for the specified <see cref="DependencyObject"/>.<br/> | ||
| /// When set, enables automatic tracking of document title changes on the <see cref="WebView2"/> control. | ||
| /// </summary> | ||
| /// <param name="obj">The object on which to set the property value.</param> | ||
| /// <param name="value">The to-be-set document title value.</param> | ||
| [DynamicDependency(nameof(GetDocumentTitle))] | ||
| public static void SetDocumentTitle(DependencyObject obj, string value) => obj.SetValue(DocumentTitleProperty, value); | ||
|
|
||
| /// <summary> | ||
| /// Handles changes to the <see cref="DocumentTitleProperty">DocumentTitle Attached Property</see>, ensures the underlying | ||
| /// <see cref="CoreWebView2"/> is initialized before subscribing to the <see cref="CoreWebView2.DocumentTitleChanged"/> event | ||
| /// and sets the initial title on the attached property. | ||
| /// </summary> | ||
| /// <param name="sender">The <see cref="DependencyObject"/> on which the property value changed.</param> | ||
| /// <param name="e">The <see cref="DependencyPropertyChangedEventArgs"/> event data.</param> | ||
| /// <exception cref="InvalidOperationException">Thrown if the attached property is applied to an object that is not a <see cref="WebView2"/> control.</exception> | ||
| private static async void OnDocumentTitleChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) | ||
| { | ||
| if (sender is not WebView2 control) | ||
| { | ||
| throw new InvalidOperationException("The attached property 'DocumentTitle' can only be applied to a WebView2 control."); | ||
| } | ||
|
|
||
| if (control.CoreWebView2 is null) | ||
| { | ||
| await control.EnsureCoreWebView2Async(); | ||
| } | ||
|
|
||
| // If CoreWebView2 is still null after attempting to ensure it, early return. | ||
| if (control.CoreWebView2 is null) | ||
| { | ||
| return; | ||
| } | ||
|
|
||
| // Remove previous event handler | ||
| control.CoreWebView2.DocumentTitleChanged -= OnCoreDocumentTitleChanged; | ||
|
|
||
| // Ensure we don't double-subscribe the Unloaded handler | ||
| control.Unloaded -= OnControlUnloaded; | ||
|
|
||
| // Subscribe to track document title changes and to clean up on Unloaded | ||
| control.CoreWebView2.DocumentTitleChanged += OnCoreDocumentTitleChanged; | ||
| control.Unloaded += OnControlUnloaded; | ||
|
|
||
| // Set initial value. CoreWebView2.DocumentTitle Property will either have the current title or be an empty string, never null. | ||
| SetDocumentTitle(control, control.CoreWebView2.DocumentTitle); | ||
| } |
There was a problem hiding this comment.
DocumentTitleProperty is also used for both subscription management (property-changed callback) and for publishing the current title (OnCoreDocumentTitleChanged calls SetDocumentTitle). Updating the title will re-enter OnDocumentTitleChanged, causing repeated EnsureCoreWebView2Async() calls and re-subscribing/unsubscribing handlers on every title update (and can lead to re-entrancy loops depending on DP change semantics). Consider introducing a separate attached boolean to enable tracking, and keep DocumentTitleProperty as a pure state value that can be updated without running the subscription setup code.
| if (sender is not WebView2 control) | ||
| { | ||
| throw new InvalidOperationException("The attached property 'IsNavigating' can only be applied to a WebView2 control."); | ||
| } |
There was a problem hiding this comment.
Throwing InvalidOperationException from an attached-property changed callback can crash apps due to style/template misuse or unexpected runtime values. Other attached-property implementations in this repo typically no-op (or log) when the target type doesn't match (e.g., TextBoxExtensions.OnInputReturnTypeChanged). Consider replacing the throw with a graceful return (optionally logging in debug) to keep the attached property safe to apply in XAML.
| private static async void OnDocumentTitleChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) | ||
| { | ||
| if (sender is not WebView2 control) | ||
| { | ||
| throw new InvalidOperationException("The attached property 'DocumentTitle' can only be applied to a WebView2 control."); | ||
| } | ||
|
|
||
| if (control.CoreWebView2 is null) | ||
| { | ||
| await control.EnsureCoreWebView2Async(); | ||
| } | ||
|
|
||
| // If CoreWebView2 is still null after attempting to ensure it, early return. | ||
| if (control.CoreWebView2 is null) | ||
| { | ||
| return; | ||
| } | ||
|
|
||
| // Remove previous event handler | ||
| control.CoreWebView2.DocumentTitleChanged -= OnCoreDocumentTitleChanged; | ||
|
|
||
| // Ensure we don't double-subscribe the Unloaded handler | ||
| control.Unloaded -= OnControlUnloaded; | ||
|
|
||
| // Subscribe to track document title changes and to clean up on Unloaded | ||
| control.CoreWebView2.DocumentTitleChanged += OnCoreDocumentTitleChanged; | ||
| control.Unloaded += OnControlUnloaded; | ||
|
|
||
| // Set initial value. CoreWebView2.DocumentTitle Property will either have the current title or be an empty string, never null. | ||
| SetDocumentTitle(control, control.CoreWebView2.DocumentTitle); | ||
| } |
There was a problem hiding this comment.
OnDocumentTitleChanged is async void and awaits EnsureCoreWebView2Async() without any exception handling or a post-await lifecycle check. If initialization fails (or the control unloads while awaiting), exceptions may surface on the dispatcher and/or event handlers may be attached to an already-unloaded control. Consider wrapping the await in try/catch (with logging) and verifying the control is still loaded before subscribing and setting the initial value.
| private static void OnNavigationStarting(WebView2 sender, CoreWebView2NavigationStartingEventArgs args) | ||
| => SetIsNavigating(sender, true); | ||
|
|
||
| private static void OnNavigationCompleted(WebView2 sender, CoreWebView2NavigationCompletedEventArgs args) | ||
| => SetIsNavigating(sender, false); | ||
|
|
||
| #endregion | ||
|
|
||
| #region DependencyProperty: DocumentTitle | ||
| /// <summary> | ||
| /// Identifies the <see cref="DocumentTitleProperty">DocumentTitle Attached Property</see> in Xaml. | ||
| /// </summary> | ||
| /// <exception cref="InvalidOperationException">Thrown if the attached property is applied to an object that is not a <see cref="WebView2"/> control.</exception> | ||
| public static DependencyProperty DocumentTitleProperty { [DynamicDependency(nameof(GetDocumentTitle))] get; } = DependencyProperty.RegisterAttached( | ||
| "DocumentTitle", | ||
| typeof(string), | ||
| typeof(WebView2Extensions), | ||
| new PropertyMetadata(string.Empty, OnDocumentTitleChanged)); | ||
|
|
||
| /// <summary> | ||
| /// Gets the value of the <see cref="DocumentTitleProperty">DocumentTitle Attached Property</see> for the specified <see cref="DependencyObject"/>. | ||
| /// </summary> | ||
| /// <param name="obj">The object from which to get the property value.</param> | ||
| /// <returns>The document title of the WebView2 control.</returns> | ||
| [DynamicDependency(nameof(SetDocumentTitle))] | ||
| public static string GetDocumentTitle(DependencyObject obj) => (string)(obj.GetValue(DocumentTitleProperty) ?? string.Empty); | ||
|
|
||
| /// <summary> | ||
| /// Sets the value of the <see cref="DocumentTitleProperty">DocumentTitle Attached Property</see> for the specified <see cref="DependencyObject"/>.<br/> | ||
| /// When set, enables automatic tracking of document title changes on the <see cref="WebView2"/> control. | ||
| /// </summary> | ||
| /// <param name="obj">The object on which to set the property value.</param> | ||
| /// <param name="value">The to-be-set document title value.</param> | ||
| [DynamicDependency(nameof(GetDocumentTitle))] | ||
| public static void SetDocumentTitle(DependencyObject obj, string value) => obj.SetValue(DocumentTitleProperty, value); | ||
|
|
||
| /// <summary> | ||
| /// Handles changes to the <see cref="DocumentTitleProperty">DocumentTitle Attached Property</see>, ensures the underlying | ||
| /// <see cref="CoreWebView2"/> is initialized before subscribing to the <see cref="CoreWebView2.DocumentTitleChanged"/> event | ||
| /// and sets the initial title on the attached property. | ||
| /// </summary> | ||
| /// <param name="sender">The <see cref="DependencyObject"/> on which the property value changed.</param> | ||
| /// <param name="e">The <see cref="DependencyPropertyChangedEventArgs"/> event data.</param> | ||
| /// <exception cref="InvalidOperationException">Thrown if the attached property is applied to an object that is not a <see cref="WebView2"/> control.</exception> | ||
| private static async void OnDocumentTitleChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) | ||
| { | ||
| if (sender is not WebView2 control) | ||
| { | ||
| throw new InvalidOperationException("The attached property 'DocumentTitle' can only be applied to a WebView2 control."); | ||
| } | ||
|
|
||
| if (control.CoreWebView2 is null) | ||
| { | ||
| await control.EnsureCoreWebView2Async(); | ||
| } | ||
|
|
||
| // If CoreWebView2 is still null after attempting to ensure it, early return. | ||
| if (control.CoreWebView2 is null) | ||
| { | ||
| return; | ||
| } | ||
|
|
||
| // Remove previous event handler | ||
| control.CoreWebView2.DocumentTitleChanged -= OnCoreDocumentTitleChanged; | ||
|
|
||
| // Ensure we don't double-subscribe the Unloaded handler | ||
| control.Unloaded -= OnControlUnloaded; | ||
|
|
||
| // Subscribe to track document title changes and to clean up on Unloaded | ||
| control.CoreWebView2.DocumentTitleChanged += OnCoreDocumentTitleChanged; | ||
| control.Unloaded += OnControlUnloaded; | ||
|
|
||
| // Set initial value. CoreWebView2.DocumentTitle Property will either have the current title or be an empty string, never null. | ||
| SetDocumentTitle(control, control.CoreWebView2.DocumentTitle); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Handles the <see cref="CoreWebView2.DocumentTitleChanged"/> event and updates | ||
| /// the <see langword="string"/> value of the <see cref="DocumentTitleProperty">DocumentTitle Attached Property</see>. | ||
| /// </summary> | ||
| /// <param name="sender">The <see cref="CoreWebView2"/> instance that raised the event.</param> | ||
| /// <param name="args">Event data.</param> | ||
| private static void OnCoreDocumentTitleChanged(CoreWebView2 sender, object args) | ||
| { | ||
| if (sender.Owner is WebView2 control) | ||
| { | ||
| // CoreWebView2.DocumentTitle Property will either have the current title or be an empty string, never null. | ||
| SetDocumentTitle(control, sender.DocumentTitle); | ||
| } |
There was a problem hiding this comment.
This introduces new observable behavior (attached properties that mirror navigation state and document title) but there are no runtime tests validating it. There are existing WebView2 runtime tests under src/Uno.UI.RuntimeTests—consider adding coverage that verifies IsNavigating toggles and DocumentTitle updates when navigating / changing document title, so regressions in event wiring or lifecycle cleanup are caught.
|
This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or it will be closed in 10 days. |
|
This PR was closed because it has been stalled for 10 days with no activity. |
GitHub Issue: closes #21473
PR Type:
What is the current behavior? 🤔
We need to manually subscribe to the
NavigationStartedandNavigationCompletedEventhandlers and need to add an DependencyProperty Registration to get a Binding supporting and automatically update-able in the shown UI like thisfind more screenshots of the app I did on my recent post on Discord
DocumentTitleProperty theCoreWebView2is aDependencyProperty, theWebView2.CoreWebView2is not, so we can not reach this through Xaml and our only Chance to get the updated DocumentTitle is by manually subscribing to the EventHandler in the Code behindWhat is the new behavior? 🚀
Adds
DocumentTitleandIsNavigatingas Attach-able Properties accepting to be bound to anWebView2control, mirroring functionality from the "old"WebView, but without changing the actual API ofWebView2.If attached, the Extensions DP will be subscribing for us to the following Events and allowing us to Bind to the property value through Xaml without needing Code behind 👍 :
DocumentTitleChangedof theWebView2.CoreWebView2NavigationStarted+NavigationCompletedand provides the Boolean propertyIsNavigatingxml Documentation:
PR Checklist ✅
Please check if your PR fulfills the following requirements:
Screenshots Compare Test Runresults.Other information ℹ️
I did not add Tests because: