locked
How to Open an HTML Page in Silverlight RRS feed

  • Question

  • I'm encountering the following error when attempting to build a Silverlight project when I add code to open an HTML webpage:

    "The type or namespace name 'Uri' could not be found (are you missing a using directive or assembly reference)?"

    Here is the code:

    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Browser;
    using System.Net;
    
    namespace gfcpaWebsite
    {
      public partial class PopupWindow : ChildWindow
      {
        public PopupWindow()
        {
          InitializeComponent();
        }
    
        public void SetMessage(string theMessage)
        {
          Message.Text = theMessage;
        }
    
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
          this.DialogResult = true;
        }
    
        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
          this.DialogResult = false;
        }
    
        private void httpCallBTTN_Click(object sender, System.Windows.RoutedEventArgs e)
        {
          System.Windows.Browser.HtmlPage.Window.Navigate(new Uri("http://www.gfcpa.com"), "_blank", "toolbar=no,location=no,status=no,menubar=no,resizable=yes");
        }
    
      }
    }
    

    It's not recognizing the Uri.  I'm running Silverlight 4.0, VS2008, with Vista.

    Thank you.

    Tuesday, April 27, 2010 2:26 PM

All replies