NativeWebView supports three rendering strategies. The correct choice depends on whether you need maximum browser fidelity, composition with Avalonia overlays, frame capture, or reduced airspace issues.
Embedded hosts the native child view directly.
Use it when you need:
Trade-off:
GpuSurface captures frames from the backend and uploads them into an Avalonia-managed GPU surface.
Use it when you need:
Trade-off:
Offscreen captures the browser surface for full managed composition by Avalonia.
Use it when you need:
Trade-off:
Embedded mode.Always check support before switching:
if (!WebViewControl.SupportsRenderMode(NativeWebViewRenderMode.Offscreen))
{
WebViewControl.RenderMode = NativeWebViewRenderMode.Embedded;
}
Composited modes expose:
CaptureRenderFrameAsyncSaveRenderFrameAsyncSaveRenderFrameWithMetadataAsyncRenderStatisticsResetRenderStatisticsThe control exposes SetCompositedPassthroughOverride(bool?) for macOS-specific composited passthrough decisions in cases where video playback or overlay behavior requires manual override.
Use this only when the default host detection does not match your scenario.
Inspect these values when capture paths are not behaving as expected:
IsUsingSyntheticFrameSourceRenderDiagnosticsMessageRenderStatistics.LastFrameOriginRenderStatistics.LastFailureMessage