This questions is not really about code but application design.
I have an app that needs authentication, to do that I have a pop up that appears on the main page when the user is not logged in.
My question is how to make this right, following the mvvm pattern. I think that the popup control should be in the code behind of the view, but who sends the order to show it? The view model or the model? Should the code behind check with the viewmodel if the user is authenticated (I don’t think that this is the correct aproach) ?
I’ve been studying the mvvm pattern and started to use mvvm light as a simple and clean way to separate the business from the presentation layer.
This problem was the first that I couldn’t figure it out by myself.
Thanks
you can do it like this. With the DataContext of the UserControl set to the current user:
You might have to read up on Converters or call the Property IsNotAuthenticated to move forward quicker.