【发布时间】:2014-07-12 11:00:32
【问题描述】:
我一直在尝试使用 caliburn 自学 WPF。大多数情况下一切正常,但我有一个我无法弄清楚的问题。我昨天得到它并试图修复它,我今天又回来了,经过很长时间我没有进一步的。如果有人知道我做错了什么,那就太棒了!
错误出现在我定义数据上下文的位置:
命名空间“clr-namespace:Translator.ViewModels”中不存在名称“TranslatorViewModel”。
我的看法:
<Window x:Class="Translator.Views.TranslatorView"
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:model="clr-namespace:Translator.ViewModels"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DataContext="{x:Type model:TranslatorViewModel}"
Title="Translator" Height="232.895" Width="1030.263">
我的视图模型:
using Caliburn.Micro;
namespace Translator.ViewModels
{
public class TranslatorViewModel : PropertyChangedBase
{
}
}
我的引导程序:
using Translator.ViewModels;
using Caliburn.Micro;
namespace Translator
{
public class AppBootstrapper : BootstrapperBase
{
public AppBootstrapper()
{
Initialize();
}
protected override void OnStartup(object sender, System.Windows.StartupEventArgs e)
{
DisplayRootViewFor<TranslatorViewModel>();
}
}
}
提前致谢!
【问题讨论】:
标签: wpf binding viewmodel caliburn