Aug 3, 2011 at 8:35 PM
Edited Aug 3, 2011 at 8:44 PM
I created a WPF app with MEF by following StockTraderRI sample. I have a view "InputView" which is located in ThroughputModule and need to be loaded in "TopRegion" in Shell. This is the code in MEF bootstrapper and I have the imported "AutoPolateExportedViewBehavior.cs",
"IViewRegionRegistration.cs", "ViewExportAttribute.cs" in to "Infrastructure" project.
protected override void ConfigureAggregateCatalog()
protected override Microsoft.Practices.Prism.Regions.IRegionBehaviorFactory ConfigureDefaultRegionBehaviors()
var factory = base.ConfigureDefaultRegionBehaviors();
And I put the "[ViewExport]" in the inputView like this:
[PartCreationPolicy(CreationPolicy.NonShared)] // creates a new instance of the view each time it is imported
[ViewExport(RegionName = "TopRegion")]
public partial class Inputs : UserControl
This is the region in Shell.xaml:
<ItemsControl Name="TopRegion" regions:RegionManager.RegionName="TopRegion" > </ItemsControl>
But when I run the shell is empty, I put break points in AutoPopulateExportedViewBehavior and in the InputView,
but none of them being hit after bootstrapper.Run().
Seems like the view doesn't get registerd at all. I have seen people talked about that the "Infrastructure" assembly was loaded
through "StockTraderRICommands" which I don't have, but I do have added "AutoPopulateExportedViewsBehavior" added in aggregationCatalog
so it should perform register exported view, right?
What could cause the problem?