Topics: Prism v4 - WPF 4
Aug 16, 2010 at 11:52 PM
Edited Aug 16, 2010 at 11:52 PM

Trying to use this behavior for popup windows.  How can I get the instance of the Composition Container in my Infrastructure project, ServiceLocator fails miserably?  Not sure what else to use. This is needed for an instance of IRegionManager to be able to add to the RM, the popup window region.


            //IRegionManager regionaManager = Container.GetExportedValue<IRegionManager>();
            IRegionManager regionManager = ServiceLocator.Current.GetInstance<IRegionManager>(); // blows up here
            if (regionManager != null)
                IRegion region = new SingleActiveRegion();
                DialogActivationBehavior behavior;
                behavior = new PopupDialogActivationBehavior();
                behavior = new WindowDialogActivationBehavior();
                behavior.HostControl = owner;
                region.Behaviors.Add(DialogActivationBehavior.BehaviorKey, behavior);
                regionManager.Regions.Add(regionName, region);

note: this is part of a static class for the dependency properties based on the ST-RI implementation.


Sep 13, 2010 at 6:17 PM

As long as the MefBootstrapper is run the ServiceLocator should have been established appropriately.  What's the timing of when this code is run?