How to redirect to silverlight page from – Education Career Blog

Net application and from one page i have to redirect to silverlight page, i am new to silverlight so i have two question

  1. Can i add silverlight page in app or i will have to add silverlight application in solution.

  2. How to redirect from page to silver.(i want to pass some data from to silver light)


To communicate between a Silverlight control and javascript in an page you can use the HTML bridge. Essentially this allows you call specially marked methods in your Silverlight control as well call javascript routines from Silverlight.

Marking a Silverlight method or attribute as accessible to javascript:

   public partial class Page : UserControl

    void Page_Loaded(object sender, System.Windows.RoutedEventArgs e)
        // Register this object in the page as Scriptable
        // so it can be accessed from within JavaScript
       HtmlPage.RegisterScriptableObject("Page", page);

    public string HelloFromSilverlight()
        return "Hello";

        public int SomeValue
            {   return _someValue;}


Calling the Silverlight method from javascript:

        // Get a reference to the actual Silverlight
        // plugin element within the page
        var plugin = pluginObject.get_element();

        // Call the HelloFromSilverlight method of our Silverlight object
        var text = plugin.Content.Page.HelloFromSilverlight();

Also see other examples:


Leave a Comment