CoreWebView2Controller.Bounds Property


Gets or sets the WebView bounds.

public System.Windows.Rect Bounds { get; set; }
public System.Drawing.Rectangle Bounds { get; set; }
member this.Bounds : System.Windows.Rect with get, set
member this.Bounds : System.Drawing.Rectangle with get, set
Public Property Bounds As Rect
Public Property Bounds As Rectangle

Property Value


Bounds are relative to the ParentWindow. The app has two ways to position a WebView:

  • Create a child HWND that is the WebView parent HWND. Position the window where the WebView should be. Use (0, 0) for the top-left corner (the offset) of the Bounds of the WebView.
  • Use the top-most window of the app as the WebView parent HWND. For example, to position ebView correctly in the app, set the top-left corner of the Bounds of the WebView.

The values of Bounds are limited by the coordinate space of the host.

Applies to