This project is read-only.

How do I access an instance from XAML?

Apr 29, 2010 at 4:29 PM

Using the service locator is quite simple from code, for instance I can do this:

            var container = new SimpleServiceLocator();

            // configure it,  BobService has a list of names
            container.RegisterSingle<IBobService>(new BobService());

            //register it
            ServiceLocator.SetLocatorProvider(() => container);

How do I bind to BobService from XAML?

 

 

Coordinator
Apr 30, 2010 at 12:17 PM

Hi Joe,

I must admit I have absolutely zero experience with XAML, so I'm not sure I can help you with this. However, I did some Googling and found this article about using MEF with XAML. The article also references the Common Service Locator. Perhaps this article is of some use to you.

Cheers

Marked as answer by dot_NET_Junkie on 11/3/2013 at 11:41 PM