开发者

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 simple

silverlight

[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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜