Hey everyone!
Today's post deals with accessing a silverlight web resource from javascript.
An example of when this is needed is if you want ineraction between a ribbon button and an embedded silverlight control.
First things first this post assumes you have already added the button to the ribbon, added the js file to the web reources and have wired up the sitemap to hit the approriate function.
So at this point you're in your JavaScript function and you want to see a web resource object on the form. First, you have tro find the name of the resource (customize the form). Once you have it you need to reference in it your js code.
Oh yeah that reminds me, you need to add [ScriptableType] to your code behind class and [ScriptableMember] to your member. Once you do that, you're silverlight web resource is good to go.
Ok so now we have a silverlight web resource control on the form and you want to find the member.
JavaScript code:
var resource = Xrm.Page.ui.controls.get("WebResource_sample");
var obj = resource.getObject();
TBD!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!