Had to post here this doesn't make any sense to me.
I am trying to call Silverlight functions from my java开发者_运维知识库script and the scriptkey I am using always comes up null.
I have this img in my markup that I want to initiate the Silverlight code.
<img alt="stop" src="stop.jpg" onclick="CallSilverlight();" />
Clicking that runs this JavaScript function.
function CallSilverlight() {
var control = document.getElementById("silverlightControlHost");
control.Content.Page.DoStuff();
}
DoStuff() is a function in my silverlight object I am trying to register it as scriptable by using this code in my silverlight class.
public Main()
{
InitializeComponent();
HtmlPage.RegisterScriptableObject("Page", this);
}
[ScriptableMember]
public void DoStuff()
{
MessageBox.Show("Hello from SL");
}
No idea what is wrong here, this is just like all the examples on the web but my Page in control.Content.Page.DoStuff(); throws this javascript error, am I missing something, this is driving me crazy.
Line: 67 Error: Unable to get value of the property 'Page': object is null or undefined
精彩评论