Silverlight ScriptableMember in Firefox 'Content is undefined' error.

Posted by Sergey Mirvoda on Stack Overflow See other posts from Stack Overflow or by Sergey Mirvoda
Published on 2010-04-23T13:01:56Z Indexed on 2010/04/23 13:03 UTC
Read the original article Hit count: 1048

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;
}

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>

© Stack Overflow or respective owner

Related posts about silverlight-3.0

Related posts about silverlight-4.0