0

Hy Guys i installed VS three times and everytime the same Error

I installed MVVM Light in the NUGET Manager for the MVVM After installing i set the DataContext in the Main.Window on MainViewModel That works now. But in my App.xaml is it not possible to get the Resource Dictonary in it. In attachment screenshots of my problem.

appxaml ( <= Full size image)

enter image description here

and...

enter image description here

Shiva
  • 20,575
  • 14
  • 82
  • 112
Botiblack
  • 9
  • 1
  • Exactly in what namespace is ViewModelLocator defined? Because I'll bet you 100$ it isn't defined in testapp. –  Jan 18 '17 at 19:40
  • I can't see if it's part of the MVVM Light framework, but if it is, your namespace is jacked. See http://stackoverflow.com/questions/17025601/ –  Jan 18 '17 at 19:47
  • You *reinstalled* Visual Studio 3 times to try and fix this? Isn't that a little bit like buying a new car to try and fix getting lost on the freeway? – Bradley Uffner Jan 19 '17 at 14:25
  • It is defined in the namespace testapp.ViewModel – Botiblack Jan 20 '17 at 12:30

2 Answers2

0

Try to declare 'vm' namespace before usage, put it in Application tag.

Thowk
  • 386
  • 4
  • 15
0

Replace <vm: with <local: as the "local" namespace is aleady mapped at the root element in App.xaml:

<Application x:Class="testapp.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:testapp.ViewModel"
             StartupUri="MainWindow.xaml">
    <Application.Resources>
        <local:ViewModelLocator x:Key="Locator" />
    </Application.Resources>
</Application>
mm8
  • 163,881
  • 10
  • 57
  • 88
  • Try xmlns:local="clr-namespace:testapp.ViewModel" as the ViewModelLocator is added to a "ViewModel" folder by default when you install MvvmLight using NuGet. I edited my answer. – mm8 Jan 20 '17 at 12:55