0

We are building a Windows 8 app and we'd like to support the snapped view. Some of our content is loaded from 3rd party HTML pages where we embed a WebView in the XAML. Everything loads fine, but we'd like to take advantage of HTML5/CSS3 to detect dimensions and choose the appropriate CSS to render the page.

So our WebView looks something like this:

<WebView x:Name="_WebView" 
         Source="{Binding NavigationUri, Mode=OneWay}"
         Width="275"
         Height="200" />

This is just an example, but how can the HTML page know that the size of the window is 275px by 200px?

4

1 回答 1

1

[编辑以获得更好的方法]

您可以从 C# 端注入一些 Javascript。有关示例,请参阅此 MSDN 线程。由于您知道 C# 代码中控件的宽度,因此您可以轻松设置一些变量或调用函数。

于 2013-05-07T12:09:38.680 回答