我想你可以使用WebBrowser
控制作爲窗口的根元素,並結合其Width
和Height
屬性窗口ActualWidth
和ActualHeigth
屬性:
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApplication4"
mc:Ignorable="d"
Title="MainWindow" Height="300" Width="300"
x:Name="win">
<WebBrowser x:Name="wb" Source="http://google.com"
Width="{Binding ActualWidth, ElementName=win}"
Height="{Binding ActualHeight, ElementName=win}"/>
</Window>
來源
2017-06-02 13:58:16
mm8