views:

90

answers:

1

Hi,

I want to know about general methods to dynamically load content into your silverlight application. More specifically, I want to create something like a widget-based application, where all GUI objects are small independent widgets. I want to provide a static chrome, like a frame, hosting the actual widget, that is loaded from an extern source like a website or is uploaded by the user and is shown in this frame.

The questions are:

  1. What does the widget author specifically have to provide, in order for me to load his widget application into my application? I imagine I have to query the provided DLL for something like a ViewModel and its DataTemplate, a UserControl or even a XAP File. What would be the best way? The external widget should also implement a certain interface, so that the outer application can call methods like Loaded and Unloaded on it. Small code samples would be appreciated.

  2. What about security? How do I prevent the inner widget application to access my outer application. I think the widget app could go up the control tree or access the DataContext of my frame control, hosting the application. Is this an issue? If so, how to solve it?

Thanks in advance! Andrej

+2  A: 

You can dynamically load controls from dlls that your widget authors could provide, MS's Mike Taulty's done a walkthrough.

Microsoft also have Prism which allows you to break up your silverlight code in a modular fashion. I haven't tried it yet to see if it's suitable for loading individual controls, but my impressions of what I've read about it seem to indicate it has a framework for doing that.

As for security, they would have access to the rest of the application, so perhaps this isn't suitable.

mattmanser
Thanks, the walkthrough was helpful.But the most important part may be security: Are there any other solutions of dynamically load Silverlight content and not have this content accessing my application? You can imagine, I don't want to check the sourcecode of each widget to see if it tries something funny with my app ;)
Andrej