Javascript Button that fires a SilverLight method? -
i've created silverlight application builds cross section image of multi-layered sphere (think concentric circles) data stored in json string. json string array of diameter+color values, , looks so:
[{"diam":100,"color:"#ffffff"},{"diam":150,color:"#ff0000"}]
i have working within silverlight. when load app in browser json above, rendering of 2 concentric circles, inner circle white (#ffffff) diameter of 100 pixels, , outer circle red (#ff0000) diameter of 150 pixels. great.
now, have integrate within html page , pass json data javascript silverlight. i'm using htmlbridge capabilities silverlight offers i'm having trouble calling silverlight method builds viz javascript.
the method name in silverlight buildviz(), removes existing elements silverlight canvas , re-builds visualization public property named jsondata. jsondata calls buildviz() method upon setting it's value:
[scriptablemember()] public string jsondata { { return _jsondata; } set { _jsondata = value; buildviz(); } }
i have tried exposing jsondata javascript using htmlbridge , setting it's value via javascript seems buildviz() method not called (or called has no effect on canvas). not sure go here. examples of htmlbridge i've seen online basic , deal simple methods converting string uppercase , returning it's value calling javascript. need run method within silverlight.
any appreciated.
tia
try this, or it
var silverlightobject = document.getelementbyid('_the_id_of_your_silverlight_obj_'); var jsondata = { value: 'hello world' } // invoke setter silverlightobject.content._the_object_containing_your_method_.set_jsondata(jsondata); // invoke getter jsondata = silverlightobject.content._the_object_containing_your_method_.get_jsondata();
Comments
Post a Comment