Use of ScriptableMember problem

Topics: Actions & Coroutines
Jun 10, 2011 at 10:09 AM
Edited Jun 10, 2011 at 10:10 AM

Hello,

I'm using Silverlight in an MVC webapplication.
In the MVC webapplication I have javascript that calls a method in the codebehind file of my View in Silverlight.
This method has to be of the type "ScriptableMember".
I wondering now if it's possible to put this methods into a ViewModel instead of in my codebehind file.

For example:

I put this in javascript:

 slCtl.Content.SL.SetMiddelenAndCalenders(middelen.ids, direction)

Calling scriptable member methods WORKS ONLY when I put this in the constructor of the codebehind file:

    HtmlPage.RegisterScriptableObject("SL"this)


I don't know if it's possible, but if it is can you tell me how to do it?


Here's a link that explains how I communicate between javascript and Silverlight:

http://www.silverlightshow.net/items/Interaction-between-Silverlight-and-HTM.aspx


Best regards,

Jeffrey