我有一个使用 Caliburn.Micro 的 wpf 应用程序。我有一个 View MyView:
<UserControl x:Class="ReferenceMaintenanceWorkspace.MyView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
>
<UserControl.Resources>
</UserControl.Resources>
<TabControl x:Name="Items" >
</TabControl>
我也有 MyViewModel:
using System.ComponentModel.Composition;
namespace ReferenceMaintenanceWorkspace
{
[Export(typeof(MyViewModel))]
public class MyViewModel
{
public MyViewModel()
{
base.DisplayName = "Reference Maintenance";
}
由于某种原因,我在选项卡控件上收到以下消息:
找不到 ReferenceMaintenanceWorkspace.MyViewModel 的 View 。
你能解释一下为什么会发生这种情况吗?
谢谢。
最佳答案
Caliburn Micro 期望在您的项目中使用特定的文件结构。您的 View 和 View 模型应该位于名为 Views 和 ViewModels 的单独文件夹中。
Here是一个很好的 Hello World 示例,描述了这一点。
关于wpf - 找不到 ViewModel 的 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11083314/