The name ViewModel does not exist in the namespace “clr-namespace:Project.ViewModels”

前端 未结 18 1858
旧时难觅i
旧时难觅i 2020-12-04 23:55

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. Alt

18条回答
  •  隐瞒了意图╮
    2020-12-05 00:53

    I had the same problem. I'd used Intellisense to build the namespace mapping and it had not included the assembly attribute, so it looked like this:

    xmlns:converters="clr-namespace:XYZ.UI.Converters;
    

    when I compared it to a working Behavior in another window, I spotted the difference. When I changed it to

    xmlns:converters="clr-namespace:XYZ.UI.Converters;assembly=XYZ.UI"
    

    cleaned it and built it, it worked.

提交回复
热议问题