我正在嘗試使用 Catel 5.4.0.0 和 Orc.Wizard 2.0.0.0 創建一個向導
我按照https://opensource.wildgums.com/orc.wizard/上的示例進行操作,但是當我呼叫向導時,它回傳錯誤“無法決議視圖‘QuotationWizardPageView’的視圖模型。
這是一些代碼
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>
在 app.xaml.cs 我有
var MyViewLocator = ServiceLocator.Default.ResolveType<IViewLocator>();
MyViewLocator.Register(typeof(QuotationWizardPageViewModel), typeof(QuotationWizardPageView));
最后我使用以下命令呼叫向導:
private async void OnAddQuotation()
{
await _wizardService.ShowWizardAsync<ASWizard.ASWizard>();
}
向導顯示,但回傳錯誤,不顯示 quoteView。
我在看什么?
uj5u.com熱心網友回復:
如果您發布的代碼是正確的(但我看到命名空間從基類繼承的另一個問題),則可能是命名空間沖突引起的。
視圖位于ZMAdmin.Views
視圖模型位于ZMAdmin.ASWizard
我的建議是使用:
- 查看型號:
ZMAdmin.ASWizard.ViewModels - 意見:
ZMAdmin.ASWizard.Views
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/490504.html
上一篇:給定向量的指標訪問向量的元素
