【发布时间】:2021-03-27 15:11:51
【问题描述】:
我正在尝试在一个非常简单的 WPF 应用程序中使用浏览器控件,并且似乎在浏览器加载我请求的页面时(我可以将鼠标悬停在图像上并查看 ALT 标记),但实际上我看不到还要别的吗:
这是应用的 XAML:
<Window x:Class="SmokeyBox2.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="SmokeyBox" Height="120" Width="510" ShowInTaskbar="False"
SizeToContent="WidthAndHeight" WindowStyle="None" AllowsTransparency="True"
MouseLeftButtonDown="Window_MouseLeftButtonDown">
<Border Background="#50FFFFFF" CornerRadius="5" BorderThickness="2,0,2,2"
Padding="5 1 5 5">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Label Grid.Row="0" Grid.Column="0" Background="Transparent" Content="SmokeyBox"
MouseLeftButtonDown="Label_MouseLeftButtonDown" />
<TextBox Grid.Row="1" Grid.Column="0" Name="searchText" Width="450" FontFamily="Arial" Foreground="DarkGray"
Background="Transparent" FontSize="20" MouseLeftButtonDown="searchText_MouseLeftButtonDown"
BorderBrush="Transparent" />
<Expander Grid.Row="1" Grid.Column="1" Padding="2 3 0 0 " Expanded="Expander_Expanded"
Collapsed="Expander_Collapsed" />
<WebBrowser Grid.Row="2" Grid.Column="0" x:Name="browser" Visibility="Visible"
Width="480" Height="480" Margin="2 2 2 2" ></WebBrowser>
</Grid>
</Border>
</Window>
那么谁能帮我弄清楚为什么浏览器没有显示 Yahoo!主页就像我问的那样?虽然我在做这件事,但我要承认这是我的第一个 WPF 应用程序,我很想听听有关如何在我的 XAML 中摆脱一般新手坏事的任何一般性指示。
谢谢。
【问题讨论】:
标签: wpf wpf-controls