Question

I'm working on a small silverlight application that involves passing some data between javascript and silverlight. I am also using the silverlight virtual earth control.

The weirdness I have come across is that is possible to register Microsoft.Maps.MapControl.LocationCollection as a script createable type and instantiate and pass it to a ScriptableMember. This is great, but I can't see where LocationCollection is tagged as a ScriptableType - am I missing something obvious.

Code in App.xaml.cs - Application_Startup

HtmlPage.RegisterCreateableType("mapLocationCollection", typeof(Microsoft.Maps.MapControl.LocationCollection));

Javascript code that works!

var locs = SLPlugin.Content.services.createObject('mapLocationCollection');

I thought that in order in instantiate an instance of the class in JavaScript the type needed to be tagged as [ScriptableType] and the type needs to be registered as a createable type. As far as I can tell LocationCollection (or any of it's superclasses) have this attribute.

Can anyone out there help me square this in my mind?

Was it helpful?

Solution

No the ScriptableType attribute specifies that all public properties, methods and events on the type are scriptable. This simply saves having mark them all with ScriptableMember.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top