C#WPF浏览器导航相关问题 [英] C# WPF browser navigation related problem

查看:100
本文介绍了C#WPF浏览器导航相关问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

XAML代码
删除了不必要的XAML代码.

这是我的代码C#

XAML code
Unnecessary XAML code removed.

This is my code C#

namespace AttoSurf
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

WebBrowser WB = new WebBrowser();
        private void textBlock1_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            
            //Create a new tab item
            TabItem item = new TabItem();
            item.Content = "One";
            //Populate the item with controls
            tabControl1.Items.Add(new WebBrowser());

            toolbar.Visibility = Visibility.Visible;
        }

        private void textBlock7_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            BMS.Items.Add(URLS.Text);
        }

        private void textBlock5_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
                   Uri uri = new Uri(this.SB.Text, UriKind.RelativeOrAbsolute);
            if (textBlock5.Text == "Go")
            {
                this.WB.Navigate(uri);
            }
        }




这是我的错误




This is my error

Relative URIs are not allowed.
Parameter name: source

推荐答案

在搜索输入不允许使用相对URI"的情况下,看看这些Google提供的线程. http://www.dreamincode.net/forums/topic/165696-wpf-web -browser-code/ [ ^ ]
http://forums.silverlight.net/p/145121/437258.aspx [ ^ ]
Have a look at these to threads that Google provided given the search input "Relative URIs are not allowed."
http://www.dreamincode.net/forums/topic/165696-wpf-web-browser-code/[^]
http://forums.silverlight.net/p/145121/437258.aspx[^]


这篇关于C#WPF浏览器导航相关问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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