C# 未知类型';ViewModelLocator';在XML名称空间中';clr名称空间:namespaceblabla;组装=blabla';
我正在构建一个WindowsPhone8.1项目,并且正在使用MVVM Light Libraries only库。 我创建了一个PCL项目来保存ViewModels,以便以后可以将其用于Windows应用商店项目 我跟着导游走 但是我在标题中发现了错误 我的App.xamlC# 未知类型';ViewModelLocator';在XML名称空间中';clr名称空间:namespaceblabla;组装=blabla';,c#,xaml,windows-phone-8,mvvm,viewmodellocator,C#,Xaml,Windows Phone 8,Mvvm,Viewmodellocator,我正在构建一个WindowsPhone8.1项目,并且正在使用MVVM Light Libraries only库。 我创建了一个PCL项目来保存ViewModels,以便以后可以将其用于Windows应用商店项目 我跟着导游走 但是我在标题中发现了错误 我的App.xaml <Application x:Class="Roadsmart.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentatio
<Application
x:Class="Roadsmart.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Roadsmart"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:viewModels="clr-namespace:Roadsmart.Lib.ViewModels;assembly=Roadsmart.Lib"
mc:Ignorable="d">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resources/RoadSmartWindowsPhoneStyle.xaml"/>
<ResourceDictionary Source="Resources/Dictionary.xaml"/>
</ResourceDictionary.MergedDictionaries>
<viewModels:ViewModelLocator
x:Key="Locator"
d:IsDataSource="True"/>
</ResourceDictionary>
</Application.Resources>
</Application>
我在Windows Phone项目中引用了Roadsmart.Lib。
我的Lib项目属性
但是Blend能够找到我的ViewModel吗
但我不能建造、运行。
我也试过打扫
有人知道我做错了什么吗
提前感谢好的,我将App.xaml改为
<Application
x:Class="Roadsmart.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Roadsmart"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:viewModels="using:Roadsmart.Lib.ViewModels"
mc:Ignorable="d">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resources/RoadSmartWindowsPhoneStyle.xaml"/>
<ResourceDictionary Source="Resources/Dictionary.xaml"/>
</ResourceDictionary.MergedDictionaries>
<viewModels:ViewModelLocator
x:Key="Locator"
d:IsDataSource="True"/>
</ResourceDictionary>
</Application.Resources>
</Application>
Basic check first:您的第一次捕获显示您已将Roadsmart.Lib
项目添加到解决方案中,但您是否正确引用了它?(基本上,如果您在Roadsmart
项目中展开引用,它将被列出。)感谢您的回复,它已被引用。请参阅更新的屏幕截图