在 wp8.1 中,应该如何使 webview 适合设备屏幕尺寸?

What should be done to fit a webview to the device screen size in wp8.1?

我正在 WP 8.1 中开发一个使用 webview 控件的应用程序。我在 4 英寸设备上测试了该应用程序,看起来不错。但是当这个应用程序在更大的设备上测试时,网络视图似乎不适合屏幕。我的 xaml 代码就像

<Grid Margin="0,0.333,0,-1.333" Height="641" VerticalAlignment="Top">
    <ProgressBar x:Name="home_progress_bar" IsIndeterminate="True" Visibility="Collapsed" Height="70" Margin="0,282,2,258" Canvas.ZIndex="999999" FontSize="15"/>
    <WebView x:Name="orderWebView" HorizontalAlignment="Left" VerticalAlignment="Top" ScriptNotify="orderWebView_ScriptNotify" NavigationStarting="orderWebView_navigation_starting" NavigationFailed="orderWebView_navigation_failed" NavigationCompleted="orderWebView_NavigationCompleted" Height="643" Width="400" DOMContentLoaded="orderWebView_DOMContentLoaded" Margin="0,0,0,-2"/>
</Grid>
<Page.BottomAppBar>
    <CommandBar x:Name="Appbar_homepage" Background="{StaticResource PhoneAccentBrush}" ClosedDisplayMode="Minimal" >
        <AppBarButton x:Name="AppButton_home" Label="home" Icon="Home" Click="AppButton_home_Click"/>
    </CommandBar>
</Page.BottomAppBar>

请指出我遗漏的内容。

您已经对 WebView 的宽度和高度进行了硬编码。删除 Width 和 Height 属性,将 Horizo​​ntalAlignment 和 VerticalAlignment 更改为 "Stretch" 并可选择使用 Margin 属性 来给它一点边距。 示例:

<WebView x:Name="orderWebView" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="10" />