c# - 命名空间 "MvxWindowsPage"中不存在名称 "using:Cirrious.MvvmCross.WindowsUWP.Views"

标签 c# xaml mvvmcross uwp

我开始使用 MVVMCross。 我已经创建了 View 和 View 模型。 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测试了它,它工作没有任何问题。

如果您使用的是正确的版本,请查看是否可以使用以下步骤重现该问题。只是想确保我们在做同样的事情。

  1. 在 Visual Studio 2015 RTM 中 -> 新建 -> 项目 -> c# -> windows -> 通用 -> 空白应用程序(通用 Windows),将其命名为“Test.Client.UWP”。

    <
  2. 右键单击 VS 解决方案资源管理器中的项目节点 -> 管理 NuGet 包 -> 选中“包含预发行版”并搜索 mvvmcross -> 选择最新预发行版 4.0.0-beta3 并安装。 (确保输出窗口没有错误)

  3. 在项目根目录中添加 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>

关于c# - 命名空间 "MvxWindowsPage"中不存在名称 "using:Cirrious.MvvmCross.WindowsUWP.Views",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32639987/

相关文章:

c# - 在数据库中只存储日期而不是时间部分 C#

c# - 当前进程的性能计数器 CPU 使用率超过 100

c# - 如何在 Xamarin.Mac 中执行终端命令并读入其输出

android - MVVM带 Backstack 的跨选项卡导航

android - 倒计时 MVVMCross 与 Xamarin Android

if 语句中的 c# 匿名方法?

xaml - Windows Phone 8.1 上的资源限定符

c# - DataTriggerBehavior 不适用于空值

c# - View 模型之间的绑定(bind)属性

android - Android中的MVVMCross绑定(bind)不起作用