New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting Window.DataContext Problem #5

Closed
yanniqq opened this Issue Sep 18, 2017 · 4 comments

Comments

Projects
None yet
2 participants
@yanniqq
Copy link

yanniqq commented Sep 18, 2017

When mindlessly following your MVVM tutorial an error occurs when trying to add the Window.DataContext

Even though the window has a reference to the right namespace and the filenames are spelled correctly, VS shows an error that :"The name Presenter does not exist in the namespace {insert namespace name}"

The solution was compiling the project first without the DataContext tags. (Found in SO comment Afterwards the Presenter class could be found and set as DataContext.

@MarkWithall

This comment has been minimized.

Copy link
Owner

MarkWithall commented Sep 18, 2017

That's quite interesting. I occasionally have problems like this when the ViewModel classes haven't been compiled yet but that seems to be fixed by compiling without having to remove anything first.

Which version of Visual Studio/.NET/etc. are you using?

I have the Resharper plugin installed. It's possible that that is silently fixing the problem for me. I'll try it with Resharper turned off and see if I can reproduce the issue.

@yanniqq

This comment has been minimized.

Copy link

yanniqq commented Sep 18, 2017

-I was using Visual Studio Professional 2013
-.Net 4.6
-Today is Monday
-It was raining when I observed the strange behaviour
-No ReSharper was used

@MarkWithall

This comment has been minimized.

Copy link
Owner

MarkWithall commented Sep 18, 2017

Thanks. I'll try it out on a selection of days of the week and weather scenarios just to be safe.

@MarkWithall

This comment has been minimized.

Copy link
Owner

MarkWithall commented Feb 15, 2018

I've finally gotten around to looking at this issue in more detail. It does appear that ReSharper was hiding the problem from me and I've updated the article accordingly. Thanks for pointing it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment