This is how you set the height and width to fill the screen in your Xamarin Forms app.
-
- Using Xamarin Essentials, get the device’s height and width.
-
var mainDisplayInfo = DeviceDisplay.MainDisplayInfo;var DeviceHeight = mainDisplayInfo.Height;var DeviceWidth = mainDisplayInfo.Width;
- Then assign those variables to your WebView.
- You can set it in Xaml
- Or in Code behind i.e. myWebview.heightRequest = DeviceHeight.
< WebView Navigated="WebView_Navigated" Navigating="WebView_Navigating" HeightRequest="{Binding DeviceHeight}" WidthRequest="{Binding DeviceWidth}">
</ WebView>