locked
JavaScript page link RRS feed

  • Question

  • I have created two seperate html pages within my silverlight web application.  I want to link them using either the HyperLink property (that expression blend 2 sept preview does not seem to like) or JScript.  If use an MouseLeftButtonUp property in my XAML what is the JScript I have to write?

     Many Thanks

    Dan (Complete Novice)

    Tuesday, February 12, 2008 11:57 AM

Answers

  • assuming your on the first page and have a button named "Button1"

    Page.xaml.js code:

    handleLoad: function(control, userContext, rootElement)
     {
      this.control = control;
    this.Btn1 = control.content.findName("Button1");
     this.Btn1.addEventListener("MouseLeftButtonUp", Silverlight.createDelegate(this, this.handleMouseUp));
     
      
     },
     handleMouseUp: function(sender, eventArgs)
     {
      window.location = "page2.html";
     }

    Tuesday, February 12, 2008 12:43 PM
  • window.location.href = theNewUrl; 

    Tuesday, February 12, 2008 12:46 PM
  • Or you can set isWindowless to true when creating the Silverlight plugin, and overlay an html hyperlink on it. Refer to this video please.

    Thursday, February 14, 2008 1:45 AM

All replies

  • assuming your on the first page and have a button named "Button1"

    Page.xaml.js code:

    handleLoad: function(control, userContext, rootElement)
     {
      this.control = control;
    this.Btn1 = control.content.findName("Button1");
     this.Btn1.addEventListener("MouseLeftButtonUp", Silverlight.createDelegate(this, this.handleMouseUp));
     
      
     },
     handleMouseUp: function(sender, eventArgs)
     {
      window.location = "page2.html";
     }

    Tuesday, February 12, 2008 12:43 PM
  • window.location.href = theNewUrl; 

    Tuesday, February 12, 2008 12:46 PM
  • Or you can set isWindowless to true when creating the Silverlight plugin, and overlay an html hyperlink on it. Refer to this video please.

    Thursday, February 14, 2008 1:45 AM
  • Please note that setting isWindowless to true comes with a performance price and can cause tearing in complex animation, so unless you need it, don't use it. The advantage of the HTML hyperlink is that the user can open the link in new tab or window, copy the link location ... etc. 

    Thursday, February 14, 2008 4:13 AM