Aracılığıyla paylaş


BlazorWebView Class

Definition

A Windows Presentation Foundation (WPF) control for hosting Razor components locally in Windows desktop applications.

public ref class BlazorWebView : System::Windows::Controls::Control, IAsyncDisposable
public class BlazorWebView : System.Windows.Controls.Control, IAsyncDisposable
type BlazorWebView = class
    inherit Control
    interface IAsyncDisposable
Public Class BlazorWebView
Inherits Control
Implements IAsyncDisposable
Inheritance
BlazorWebView
Implements

Constructors

BlazorWebView()

Creates a new instance of BlazorWebView.

Fields

BlazorWebViewInitializedProperty

The backing store for the BlazorWebViewInitialized event.

BlazorWebViewInitializingProperty

The backing store for the BlazorWebViewInitializing event.

HostPageProperty

The backing store for the HostPage property.

RootComponentsProperty

The backing store for the RootComponent property.

ServicesProperty

The backing store for the Services property.

StartPathProperty

The backing store for the StartPath property.

UrlLoadingProperty

The backing store for the UrlLoading property.

Properties

BlazorWebViewInitialized

Allows customizing the web view after it is created.

BlazorWebViewInitializing

Allows customizing the web view before it is created.

HostPage

Path to the host page within the application's static files. For example, wwwroot\index.html. This property must be set to a valid value for the Razor components to start.

RootComponents

A collection of RootComponent instances that specify the Blazor IComponent types to be used directly in the specified HostPage.

Services

Gets or sets an IServiceProvider containing services to be used by this control and also by application code. This property must be set to a valid value for the Razor components to start.

StartPath

Path for initial Blazor navigation when the Blazor component is finished loading.

UrlLoading

Allows customizing how links are opened. By default, opens internal links in the webview and external links in an external app.

WebView

Returns the inner WebView2 used by this control.

Methods

CreateFileProvider(String)

Creates a file provider for static assets used in the BlazorWebView. The default implementation serves files from disk. Override this method to return a custom IFileProvider to serve assets such as wwwroot/index.html. Call the base method and combine its return value with a CompositeFileProvider to use both custom assets and default assets.

DisposeAsync()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.

DisposeAsyncCore()

Allows asynchronous disposal of the BlazorWebView.

OnApplyTemplate()

When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate().

OnInitialized(EventArgs)

Raises the Initialized event. This method is invoked whenever IsInitialized is set to true internally.

TryDispatchAsync(Action<IServiceProvider>)

Calls the specified workItem asynchronously and passes in the scoped services available to Razor components.

Applies to