Silverlight ScriptableMember in Firefox 'Content is undefined' error
Recently I'm learned how to call SIlverlight methods from JavaScript.
All works fine (even in Chrome !). But in FireFox 3 (3.6.4) registered Page object is undefined. My Code is very simplesilverlight
[ScriptableMember]
public bool HasFilter()
{
return true;
}
And in MainPage constructor
public MainPage()
{
InitializeComponent();
HtmlPage.RegisterScriptableObject("Page",this);
LayoutRoot.DataContext = viewModel;
Loaded += OnLoaded开发者_StackOverflow中文版;
}
JavaScript
<head>
<script type="text/javascript">
function UpdateFilter() {
var sl = document.getElementById('SilverlightChartControl');
alert(sl);
alert(sl.Content.Page.HasFilter());
}
</script>
</head>
<body>
<a href="#" id="resize" onclick="UpdateFilter(); return false;">TEST</a>
</body>
I've converted code to SL4, installed new plugin (4.0.50401.0) and now it works as expected.
精彩评论