views:

41

answers:

2

What I'm trying to attempt is to access methods on a Silverlight control via the COM automation model. Theoretically it should be possible, as exposing the Silverlight control's methods as scriptable members exposes them through an IDispatch interface. I have been able to access the IDispatch interface through the automation model correctly but when I attempt to call a method on the exposed interface via Invoke it crashes.

I was wondering if anyone knew whether this was expected behaviour, i.e. I'm violating some basic sandboxing requirement, or whether this should work and it is just something in my implementation that needs correcting? Cheers.

A: 

There is an alternate hosting model available, details on MSDN: http://msdn.microsoft.com/en-us/library/dd550717(v=VS.95).aspx

It is very involved to use these methods, but you might just need to do that.

Here's the Silverlight agcore COM reference: http://msdn.microsoft.com/en-us/library/cc296246(v=VS.95).aspx

Jeff Wilcox
A: 

To answer my question, yes this is possible and exactly as per my question's description. The caveat turned out to be that Silverlight doesn't provide an event corresponding to when a call to the IDispatch interface will succeed, e.g. when it's initialized "enough" to correctly respond.

Upon stopping my attempts on load events (e.g. OnLoad, OnPageComplete, etc) and making it a manual step off a button or similar I could successfully access the IDispatch interface.

dlanod