title | author | description | keywords |
---|---|---|---|
WebViewExtensions |
nmetulev |
The WebViewExtensions class allows attaching HTML content to a WebView control through XAML directly or through a binding |
windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, WebViewExtensions, webview, extensions |
The WebViewExtensions
allows attaching HTML content to WebView
.
Platform APIs:
WebViewExtensions
Here is how the WebViewExtensions
properties can be used in XAML:
<!-- Attach HTML content directly to a WebView -->
<WebView
xmlns:ui="using:Microsoft.Toolkit.Uwp.UI"
ui:WebViewExtensions.Content="{Binding HtmlContent}" />
<!-- Attach a Uri directly to a WebView -->
<WebView
xmlns:ui="using:Microsoft.Toolkit.Uwp.UI"
ui:WebViewExtensions.ContentUri="{Binding ContentUri}" />
Note
In this example, the classic binding syntax is used, but the faster {x:Bind}
syntax is supported as well. You're free to pick which one to use depending on your use case scenario.
You can find more examples in the unit tests.