by preishuber via Hannes Preishuber on 8/24/2008 6:05:26 AM
My original problem was a call from HTMl via Jscript to the internals of a Silverlight plugin. My code fails I had huge problems to find the issue cause debugging doesn’t help and jScript doesnt support intellisense i a complete matter.
My checklist
1) Silverlight 1.0 uses a findname construct, Silverlight 2.0 the xaml class must expose a <Scriptable> member and it must be registered with RegisterScriptObject
HtmlPage.RegisterScriptableObject(
2) The Call by Jscript from a Silverlight event method like loaded, have a sender object as parameter. On that you can use getHost to get a instance of Silverlight host.
If you call without, like a hmtl button click, you have to find the the Silverlight plugin.
3) ASPX or HTML. Silverlight projects in Visual Studio 2008 creates a additional web project. This have to test pages. A html and a aspx.
ASPX
HTML
<
The ID of the Silverlight Plugin is set with the ID attribute. There are different default values in ASPX and HTML (XAML1). If you miss the ID, Silverlight will work.
4) you can read the created plugin id during runtime
Private Sub page8_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded HtmlPage.RegisterScriptableObject("hannespre", Me) label1.Text = HtmlPage.Plugin.Id End Sub
5) From HTML following code access Plugin
{
slhost.content.hannespre.interntext(
}
6) take care on pressing F5 and starting debugging. Can start HTMl or ASPX page (and your code is in other page)
Original Post: Silverlight 2.0 plugin ID or not ID
The content of the postings is owned by the respective author. Silverlight Feeds is not responsible for the contents of the postings. This site is automatically generated and cannot be reviewed for abusive content. If you find abusive content on Silverlight Feeds, please contact us. Designated trademarks and brands are the property of their respective owners. All rights reserved.