开发者

LocationCollection not tagged as ScriptableType but can be instantiated in script (How come?)

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 supercl开发者_如何转开发asses) have this attribute.

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


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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜