locked
Silverlight 1.1 and javascript RRS feed

  • Question

  • Hello All ,

                  I am new to silverlight development and was trying to read an example on one of the websites . They had a XAML file which was making calls to the Javascript event handlers for mouse up and down events . Now i tried doing the example on my machine .My machine has silverlight 1.1. I get page.xaml and page.xaml.cs. I dont know where to add the javascript code for the XAML file

     So does it mean i cannot do any examples of javascript in 1.1 ?

     Thanks in advance.

    Sunday, February 24, 2008 2:50 PM

Answers

All replies

  •  Actually, you can put the Javascript in TestPage.html or TestPage.html.js where you host SL content. but as you are using SL 1.1, you don't need to use Javascript for that. you can simply use this code in managed code.

    Please check-out this video.. http://silverlight.net/learn/learnvideo.aspx?video=337 You will learn how to write those events in C# and how to drag and drop.  

    Sunday, February 24, 2008 8:39 PM
  • So the XAML file will know that the javascript is placed in the testpage.html or testpage.html.js or is there a special directive that we have to place in the XAML file to make it point to the corresponding java script.

     I know this is a little archiac . I have already began using C# for handling back end logic . But i just want to see how silverlight 1.1 would work with javascript.

     

    Thanks for your response.

    Monday, February 25, 2008 11:02 AM
  • Hello, where you put your JavaScript code is not important. What you need to do is, in your testpage.html file, add a script tag like this:

    <script type="text/javascript" src=" testpage.html.js"></script>

     

    This will tell the hosting html page to include testpage.html.js, so functions in that js file can be used throughout the html page and your Silverlight application.

     

    Tuesday, February 26, 2008 12:17 AM
  • Tuesday, February 26, 2008 12:48 AM
  •  Hey Klusener, from your words I just thought you dunno the differences between silverlight 1.0 and 1.1?! If you know them plz mention in order to have enough information to help .. Thnx

    Tuesday, February 26, 2008 12:41 PM
  • No the question was how to make javascript run in silverlight 1.1 , i dont think i have mention 1.0 anywwhere in the post .

    I know that 1.0 supports javascript exclusively , but i wanted to know how can one make javascript work with 1.1 . If you feel like i am missing something please reply.

    Tuesday, February 26, 2008 1:07 PM
  • Hi:

      Did you read the article mentioned in my previous post? It's about how to call javascript function using C#. (It's my understanding to your "make javascript work in 1.1").

    Regards

    Tuesday, February 26, 2008 8:19 PM