Search code examples
silverlightxamlcastle-windsorcontainersresolve

Good idea to resolve XAML in Silverlight 4 with WIndsor container?


Currently, I am resolving xamls from the container so that i can make use of dependency injection much more easily and ellegantly. It's a web application all written in Silverlight 4 with windsor castle container. I have a 2007 office ribbon and when an menu item is clicked, and the content control below the ribbon is replaced with the relevant xaml.

But is it a good idea to resolve xaml from the container? I am worried about perfomance issue.

Can someone please show me a proper of doing masterpages like in ASP.NET ? I would only like to resolve the xaml when an menu item is clicked. How can i do that? Currently, i resolved every XAML from the constructor before the menu is clicked! So very inefficient!

Any better suggestions?


Solution

  • It's not hard, but to me it's somewhat underspecified, even strange question.

    What do you mean by 'resolving XAML with Windsor'? I'm not aware of any IoC container capable of XAML integration of any kind.

    However, if all you need to do is to have some kind of master page-like concept in Silverlight, you have several options:

    1. Use Prism and their Region concept.
    2. Use some other MVVM library and their equivalent for Region (Caliburn is great), but note that ultimately this boils down to replacing 'placeholders' that are ContentControls
    3. Do the same as (2), use ContentControls and replace their content by hand (probably what you're doing now I suppose)

    If you provided more information with a more specific inquiry, we might be able to help you more.