我一直在构建一个简单的 RSS 应用程序,但我遇到了这个问题。
<common:LayoutAwarePage
x:Name="pageRoot"
x:Class="App4.View.RssMainView"
DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App4.View"
xmlns:common="using:App4.Common"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="using:App4.ViewModel"
mc:Ignorable="d">
<Page.Resources>
<vm:RssMainViewModel x:Key="ViewModel" x:Name="ViewModel"
FeedUrlString="http://blogs.msdn.com/b/juank/rss.aspx"/>
<!-- TODO: Delete this line if the key AppName is declared in App.xaml -->
<x:String x:Key="AppName">My Application</x:String>
</Page.Resources>
我的 App4.ViewModel 看起来像这样;
using App4.Common;
using App4.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using App4.Util;
namespace App4.ViewModel
{
public class RssMainViewModel : BindableBase
{
private ArticleList _articles = new ArticleList();
public ArticleList Articles
{
get { return _articles; }
set
{
SetProperty(ref _articles, value);
}
}
private string _feedUrlString;
public string FeedUrlString
{
get { return _feedUrlString; }
set
{
SetProperty(ref _feedUrlString, value);
}
}
}
}
它显示此错误“名称“RssMainView”在命名空间“using:App4.ViewModel”中不存在我该如何解决?