我有以下代码:
<Page x:Class="TestApp.Views.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="using:TestApp.ViewModels">
<Page.DataContext>
<vm:MainPageViewModel x:Name="ViewModel" />
</Page.DataContext>
我收到了这个错误:
名称&#34; MainPageViewModel&#34;命名空间中不存在&#34;使用:TestApp.ViewModels&#34;
我的viewmodel类看起来像这样:
namespace TestApp.ViewModels
{
public class MainPageViewModel : BaseViewModel
{
public MainPageViewModel()
{
}
}
}
该应用程序构建并运行良好,但由于此错误,我无法看到我在编写xaml时正在做的事情。
我该如何解决这个问题?