命名空间 "using:Cirrious.MvvmCross.WindowsUWP.Views" 中不存在名称 "MvxWindowsPage"
The name "MvxWindowsPage" does not exist in the namespace "using:Cirrious.MvvmCross.WindowsUWP.Views"
我开始使用 MVVMCross。
我已经创建了视图和视图模型。
View.xaml 看起来像这样:
<views:MvxWindowsPage
x:Class="xxx.Client.UWP.Views.View1"
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:views="using:Cirrious.MvvmCross.WindowsUWP.Views"
mc:Ignorable="d">
但是我得到这个错误:
The name "MvxWindowsPage" does not exist in the namespace "using:Cirrious.MvvmCross.WindowsUWP.Views"
但在我的 View.xaml.cs 中,我从它继承而没有错误:
public sealed partial class View1 : Cirrious.MvvmCross.WindowsUWP.Views.MvxWindowsPage
你知道问题出在哪里吗?
谢谢。
我用MvvmCross 4.0.0-beta3测试过,没有任何问题。
如果您使用的是正确的版本,请查看是否可以使用以下步骤重现该问题。只是想确保我们在做同样的事情。
In Visual Studio 2015 RTM->new->project->c#->windows->universal->Blank App(UniversalWindows)名称它 "Test.Client.UWP".
在VS解决方案资源管理器中右击项目节点->管理NuGet包->勾选"include prerelease"并搜索mvvmcross->Select最新预发布版4.0.0- beta3 并安装。 (确保输出没有错误window)
在项目根目录下添加Views文件夹->添加一个名为View1的空白页->做如下修改:
改为View1.xaml.cs
namespace Test.Client.UWP.Views
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class View1 : Cirrious.MvvmCross.WindowsUWP.Views.MvxWindowsPage
{
public View1()
{
this.InitializeComponent();
}
}
}
改为View1.xaml
<views:MvxWindowsPage
xmlns:views="using:Cirrious.MvvmCross.WindowsUWP.Views"
x:Class="Test.Client.UWP.Views.View1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Test.Client.UWP.Views"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
</Grid>
</views:MvxWindowsPage>
我开始使用 MVVMCross。 我已经创建了视图和视图模型。 View.xaml 看起来像这样:
<views:MvxWindowsPage
x:Class="xxx.Client.UWP.Views.View1"
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:views="using:Cirrious.MvvmCross.WindowsUWP.Views"
mc:Ignorable="d">
但是我得到这个错误:
The name "MvxWindowsPage" does not exist in the namespace "using:Cirrious.MvvmCross.WindowsUWP.Views"
但在我的 View.xaml.cs 中,我从它继承而没有错误:
public sealed partial class View1 : Cirrious.MvvmCross.WindowsUWP.Views.MvxWindowsPage
你知道问题出在哪里吗?
谢谢。
我用MvvmCross 4.0.0-beta3测试过,没有任何问题。
如果您使用的是正确的版本,请查看是否可以使用以下步骤重现该问题。只是想确保我们在做同样的事情。
In Visual Studio 2015 RTM->new->project->c#->windows->universal->Blank App(UniversalWindows)名称它 "Test.Client.UWP".
在VS解决方案资源管理器中右击项目节点->管理NuGet包->勾选"include prerelease"并搜索mvvmcross->Select最新预发布版4.0.0- beta3 并安装。 (确保输出没有错误window)
在项目根目录下添加Views文件夹->添加一个名为View1的空白页->做如下修改:
改为View1.xaml.cs
namespace Test.Client.UWP.Views
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class View1 : Cirrious.MvvmCross.WindowsUWP.Views.MvxWindowsPage
{
public View1()
{
this.InitializeComponent();
}
}
}
改为View1.xaml
<views:MvxWindowsPage
xmlns:views="using:Cirrious.MvvmCross.WindowsUWP.Views"
x:Class="Test.Client.UWP.Views.View1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Test.Client.UWP.Views"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
</Grid>
</views:MvxWindowsPage>