wpfwizardcatel

Wizard using Orc.Controls.Wizard and Catel


I'm trying to create a wizard using Catel 5.4.0.0 and Orc.Wizard 2.0.0.0

I followed the example on https://opensource.wildgums.com/orc.wizard/ but when I call the wizard it returns the error "The view model of the view 'QuotationWizardPageView' could not be resolved.

Here is some code

using Orc.Wizard
using System

namespace ZMAdmin.ASWizard
{
    public class QuotationWizardPage : WizardPageBase
    {
        public QuotationWizardPage()
        {
            Title = "Offerte";
            Description = "Offerte";
        }
    }
}

using Orc.Wizard;
using System;

namespace ZMAdmin.ASWizard
{
    public class QuotationWizardPageViewModel : WizardPageViewModelBase<QuotationWizardPage>
    {
        public QuotationWizardPageViewModel(QuotationWizardPage wizardPage)
            : base(wizardPage)
        {
        }
    }
}

using Catel.Ioc;
using Orc.Wizard;

namespace ZMAdmin.ASWizard : WizardBase
{
    public ASWizard(ITypeFactory typeFactory)
        : base (typeFactory)
    {
        Tittle = "Bedrijfsnaam";
        
        this.AddPage<QuotationWizardPage>();
    }
}

<catel.UserControl x:Class="ZMAdmin.Views.QuotationWizardPageView"
                    xmlns:catel="http://schemas.catelproject.com"
                    >
                    
</catel.UserControl>

in the app.xaml.cs I've

var MyViewLocator  = ServiceLocator.Default.ResolveType<IViewLocator>();
MyViewLocator.Register(typeof(QuotationWizardPageViewModel), typeof(QuotationWizardPageView));

And last I call the wizard using:

private async void OnAddQuotation()
{
    await _wizardService.ShowWizardAsync<ASWizard.ASWizard>();
}

The wizard displays, but returns the error, not displaying the quotationView.

What am I overlooking?


Solution

  • If the code you posted is correct (but I see another issue where a namespace is inheriting from a base class), it's probably caused of namespace conflicts.

    The view is located in ZMAdmin.Views The view model is located in ZMAdmin.ASWizard

    My recommendation is to use: