用于导航到网页的按钮 [英] Button to navigate to webpage

查看:78
本文介绍了用于导航到网页的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Blend WPF应用程序上创建一个简单的按钮来打开像
这样的网页 http:// www.bing.com

How do I just create a simple button on a Blend WPF application to open a webpage like http://www.bing.com?

推荐答案

使用WebBrowser控件打开一个PopUp:

Just open a PopUp using the WebBrowser control:


<Window
    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" mc:Ignorable="d" x:Class="WpfApplication3.Window1"
    Title="Window1" Height="200" Width="300">
	<Window.Resources>
		<Storyboard x:Key="OnClick1">
			<BooleanAnimationUsingKeyFrames Storyboard.TargetProperty="(Popup.IsOpen)" Storyboard.TargetName="popup">
				<DiscreteBooleanKeyFrame KeyTime="0" Value="True"/>
			</BooleanAnimationUsingKeyFrames>
		</Storyboard>
	</Window.Resources>
	<Window.Triggers>
		<EventTrigger RoutedEvent="ButtonBase.Click" SourceName="button">
			<BeginStoryboard Storyboard="{StaticResource OnClick1}"/>
		</EventTrigger>
	</Window.Triggers>
		<Grid>
			<Button x:Name="button" Content="Go To Bing!" HorizontalAlignment="Center" Width="200" Height="100" />
			<Popup x:Name="popup">
				<WebBrowser Height="600" Width="800" Source="http://www.bing.com/"/>
			</Popup>
	    </Grid>
</Window>


这篇关于用于导航到网页的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆