This project is read-only.

Using MEF navigation

Nov 4, 2013 at 7:47 AM
I have the navigation up and running with MEF and it is all working for the MainWindow and the related loading of content for Sources.

Where I am stuck is I have the scenario where I want to open a second ModernWindow.

The scenario I use is as follows

There is a ModernButton
<mui:ModernButton IconData="{DynamicResource icon_config}"  Command="{Binding cmdDialogSupplier}" EllipseDiameter="20"  Margin="2,0,0,0" >
      <MultiBinding Converter="{StaticResource URLStringMultiple}" ConverterParameter="SBO.Client.View.Pricing;Component/Content/Supplier/SupplierConfig.xaml?new={0}&amp;code={1}&amp;name={2}">
      <Binding  Path="SelectedSupplier.IsNew"  />
       <Binding  Path="SelectedSupplier.Code"  />
       <Binding  Path="SelectedSupplier.Name"  />
This goes to the ViewModel which has a shared import which then opens a new ModenWindow based on the URI

The ModernWindow opens and the source is loaded.

However the navigation within the new ModernWindow is NOT using the MEF content loader.

Initially I was confused as to why the ViewModels were not being imported and then I noticed that the content was loaded as the project directory layout matches the URI schema. So it was loading, but not through MEF.

If I remove the MEF Content Metadata for the "ContentExport" the content loads.

Is there a method of having the 'second' ModernWindow also use the MEF content loader ?
Nov 4, 2013 at 7:52 AM
Found what I was doing wrong.

I needed to change to use a ModernWindow which was a control (and not just a new ModerWindow) and add the reference to the Application.xaml as a style similar to what it say in the documentation about creating MEF !
            <Style TargetType="pricingModule:SupplierWindow">
                <Setter Property="ContentLoader" Value="{DynamicResource MefURILoader}" />
Marked as answer by ShaneC112 on 11/3/2013 at 11:53 PM