Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4038742
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T12:30:38+00:00 2026-05-20T12:30:38+00:00

Im just getting started on this whole WPF thing, and need to understand some

  • 0

Im just getting started on this whole WPF thing, and need to understand some basic elements. I gotten so far that i undrstand the Model, the View and the ViewModel in the MVVM pattern.

What i dont get is where/how to go about chaning my UI based on this.

Lets say i have an application where i need to login first. my login is a view and a viewmodel+model i have. No problem in showing this one, because its the “startup” view i simply add it in my window’s constructor (right or wrong?). When the user has successfully logged in, i want to change the view and the viewmodel to eg. a dashboard view+viewmodel. Should i do all this manually, just removing the usercontrol that was the login, then adding the other usercontrol that is the dashboard? and then change the datacontext? How is this normally accomplished?

My concern is that im introducing a lot of code simply to switch view+viewmodel, and this bothers me a bit. What when i go from dashboard to customerlisting, then to projectlisting etc. do I write this logic in my eventhandler /command for the button pressed?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T12:30:39+00:00Added an answer on May 20, 2026 at 12:30 pm
    • the view is the UI (could be a window, page, usercontrol)
    • the view model is the back-end to that view

    Your login window would have its own view model and your dashboard would have its own view model. You don’t switch view models manually.

    So the user enters his/her username and password and hits enter, the login view model gets the data via binding in the view then the model validates the credentials, if they’re correct then the dashboard appears which is bound to its view model.

    You have a login view and view model + dashboard view and view model + other view and view models for other controls.

    — Update:

    Let’s say you have the following:
    – Window
    – Login control
    – Dashboard control

    All have their own views (V) and view models (VM)
    The Window VM has two visibility properties, the Login and the Dashboard visibility properties in the Window V bind to them.

    When the app starts the Login control is visible, when the login is successful, the model tells the Window VM to set the Login visibility property to collapsed and the Dashboard visibility property to visible, which then the Window VM tells the Window V to hide the Login control and show the Dashboard control.

    “tells” means raise event, send a message, call a method – depends on how you implement MVVM.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm just getting started with Threads in Java so this might be a basic
I just started getting this error today, seemingly out of nowhere. Any one see
I'm just getting started on writing functions instead of writing everything inline. Is this
I am just getting started with NHaml and ran into a snag. This is
I'm just getting started learning CoreData for iOS and have written some exploratory code
Just started getting a bunch of errors on our C# .Net app that seemed
Sorry, if this is a noobish question, but I'm just getting started with Rails
So I'm getting really confused on how to do this whole thing and I
I'm just getting started with MySql and need to run simple queries on the
Just getting started with C++ here. I am working on OSX with Eclipse CDT.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.