NativeWebView is the embedded browser control for Avalonia. It derives from NativeControlHost and resolves the active platform backend either from an explicitly supplied backend or from NativeWebViewRuntime.
Embedded, GpuSurface, and Offscreen.| Property | Purpose |
|---|---|
Source, CurrentUrl |
Current navigation target and current URL. |
IsInitialized |
Indicates whether backend initialization completed. |
CanGoBack, CanGoForward |
Navigation history state. |
IsDevToolsEnabled, IsContextMenuEnabled, IsStatusBarEnabled, IsZoomControlEnabled |
Capability-backed runtime toggles. |
ZoomFactor, HeaderString, UserAgentString |
Browser behavior configuration. |
RenderMode, RenderFramesPerSecond |
Render strategy and frame pump rate for composited modes. |
IsUsingSyntheticFrameSource, RenderDiagnosticsMessage, RenderStatistics |
Composition diagnostics and capture statistics. |
MacOsCompositedPassthroughOverride |
Manual passthrough override for macOS composited mode. |
InitializeAsyncNavigate, Reload, Stop, GoBack, GoForwardExecuteScriptAsyncPostWebMessageAsJsonAsync, PostWebMessageAsStringAsyncOpenDevToolsWindowPrintAsync, ShowPrintUiAsyncSetZoomFactor, SetUserAgent, SetHeaderTryGetCommandManager, TryGetCookieManagerMoveFocusSupportsRenderModeSetCompositedPassthroughOverrideCaptureRenderFrameAsync, SaveRenderFrameAsync, SaveRenderFrameWithMetadataAsyncGetRenderStatisticsSnapshot, ResetRenderStatisticsTryGetPlatformHandle, TryGetViewHandle, TryGetControllerHandleCoreWebView2Initialized, CoreWebView2EnvironmentRequested, CoreWebView2ControllerOptionsRequestedNavigationStarted, NavigationCompleted, NavigationHistoryChangedWebMessageReceived, NewWindowRequested, WebResourceRequested, ContextMenuRequestedRequestCustomChrome, RequestParentWindowPosition, BeginMoveDrag, BeginResizeDrag, DestroyRequestedRenderFrameCapturedBackends advertise support through Features. When a backend does not support an operation, capability flags expose that in advance and the method call throws PlatformNotSupportedException if invoked anyway.
NativeWebViewRuntime.EnsureCurrentPlatformRegistered();
await WebViewControl.InitializeAsync();
WebViewControl.Navigate("https://example.com");
Use composited-mode diagnostics when you need capture telemetry or airspace investigation:
IsUsingSyntheticFrameSourceRenderDiagnosticsMessageRenderStatisticsGetRenderStatisticsSnapshotCaptureRenderFrameAsyncSaveRenderFrameWithMetadataAsyncResetRenderStatisticsRender statistics expose capture counters and last-frame metadata, including attempt, success, failure, and skip counts together with last failure details.
Sidecar metadata includes FrameId, CapturedAtUtc, RenderMode, Origin, PixelDataLength, and PixelDataSha256.
Use NativeWebViewRenderFrameMetadataSerializer.ReadFromFileAsync to load the sidecar JSON and TryVerifyIntegrity to validate captured frames against the stored integrity fields.