本文介绍了使用按钮单击打开网页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好
我尝试在我的应用上添加按钮和文本框
I try to add button and text box on my app
我想要的功能在文本框中键入一些Url并单击按钮
the function that i want when i type some Url on textbox and click the button
在我的默认浏览器上打开的网页
the web page open on my default browser
推荐答案
你可以轻松地做到这一点,代码片段在
you can do that easily , the snippet is below
//use the code in button click event
internal async void OpenPage(object sender, routedeventargs e)
{
var MyText=TextBox.Text;
var dlink = new Uri(MyText);
await Windows.System.Launcher.LaunchUriAsync(dlink);
}
这篇关于使用按钮单击打开网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!