KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Now that's a real strange error. I am working on a WPF application and following MVVM. In my MainWindow I am setting views and view models and I get this strange error. Although it builds fine and application runs fine, but why I am getting this error. I also followed some similar but didn't find appropriate answer. I tried to restart visual studio and clean and rebuild, but still I face this error. So here is the code. <Window x:Class="MyProject.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:v="clr-namespace:MyProject.Views" xmlns:vm="clr-namespace:MyProject.ViewModels" xmlns:p="clr-namespace:MyProject.Properties" Title="{x:Static p:Resources.Title}" Height="400" Width="750" MinHeight="400" MinWidth="750"> <Window.Resources> <DataTemplate DataType="{x:Type vm:MainPageViewModel}"> <v:MainPageView/> </DataTemplate> </Window.Resources> Error 1 The name "MainPageViewModel" does not exist in the namespace "clr-namespace:MyProject.ViewModels". Here is my ViewModel namespace MyProject.ViewModels { public class MainPageViewModel : PropertyChangedBase { public MainPageViewModel() { } } } So what is real error. I am using Visual Studio 2012 by the way. Update: My viewmodels and views are in the same project. I am not referencing to any other project. And MyProject.ViewModels.MainPageViewModel exists.
Tags (comma-separated)
Save Edits
Cancel