javascript - passing parameters to running silverlight application -


the scenario have list of items in html; when click on item use js dynamically create html load silverlight app passing in specific item # (using initparams); , silverlight app visualizes in nice way. on same page rather loading new webpage, , transition smooth.

i know possible have silverlight call js function on page (opposite need). i'm thinking possible js function raise event/call method in silverlight, not sure how - has tried this? while workaround recreate silverlight app each time, raising event in existing, loaded sl app would perfect solution problem.

regards ewart.

you can call method in silverlight application javascript. see blog post

you need create class in silverlight app registers callable js:

[scriptabletype] public partial class someclass {     private bool mousehelddown = false;     private point movemeoffset = new point();      public someclass()     {         htmlpage.registerscriptableobject("silverlightobject", this);     }       [scriptablemember]     public void dothing(int x)     {       //do stuff     } } 

then can call js

document.getelementbyid("mysilverlightcontrol").content.silverlightobject.dothing(5); 

Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -