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 469175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T23:45:22+00:00 2026-05-12T23:45:22+00:00

I have been working through Josh Smith’s article on MVVM at http://msdn.microsoft.com/en-us/magazine/dd419663.aspx . Each

  • 0

I have been working through Josh Smith’s article on MVVM at http://msdn.microsoft.com/en-us/magazine/dd419663.aspx. Each section makes sense to me but I am having a hard time putting it all together as a coherent unit mentally. I have 2 questions that would help a ton.

  1. If I were to build the sample ap, what would be the logical order to build it?

  2. For the command structure, what happens, in what order when the ap is run?

I am also wondering if I should split this into 2 questions?

  • 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-12T23:45:22+00:00Added an answer on May 12, 2026 at 11:45 pm
    1. I agree with Yacoder on this one. Start with what you know, or your vision. If your vision is to get a certain UX, start in Expression Blend if you want to. If you know what functionality you want, start with the ViewModels and the Unit tests.

    2. Smith’s application starts with App.xaml.cs.
      There the MainWindowViewModel and the MainWIndow is created and shown.

    MainWindow.xaml is the next thing that happens. It defines the main portion of the UI. The main parts of this is showing two collections; Commands and Workspaces. Those are members of MainWindowViewModel.

    Smith seems to like properties to check if their corresponding private fields are null and, if they are, assign them. Thus the “Commands” collection is created in line 51 of MainWindowViewModel which calls CreateCommands() just south of there.

    The command classes are abstracted away by RelayCommand, probably because each command doesn’t need to know much in the case of “Show All” or “Create”. The methods for these two commands are in the MainWindowViewModel, because they are conceptually functions of the main window.

    The Commands collection is visualized as a list in the Main Window, so they need some kind of presentable, user friendly text to describe them. Thus they are wrapped in their own CommandViewModels.

    The commands are presented through the magic of XAML beginning at line 41 of MainWindow.xaml. The HeaderedContentControl is databound to the Commands collection, and specifies CommandsTemplate of MainWindowResources.xaml (starting at line 93 of that file). The template uses a HyperLink with its Command property bound to the Command property of the CommandViewModel.

    When it comes to the Save button on the new customer form. This is bound from CustomerView.xaml, line 117. To the CustomerViewModel SaveCommand property in line 196. It is a RelayCommand pointing to methods in CustomerViewModel. Each customer view has its own instance of CustomerViewModel where the data for that customer goes. The instances of RelayCommand belong to those CustomerViewModels, so each view has it’s own SaveCommand also. The action and predicate of the RelayCommand instance knows not only which methods and properties they point to, but also of which instance. The Save method of CustomerViewModel only uses data from that instance.

    That’s roughly how two views can have the same kind of buttons that do the same for their respective customer data.

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

Sidebar

Related Questions

I have been working through a tutorial ( http://glacialflame.com/category/tutorial/ ) to build an Isometric
I have been working through some of the examples of MVVM & WPF and
I have been working through Microsoft's ASP.NET MVC tutorials, ending up at this page
I have been working through the tutorial at http://bkiers.blogspot.de/2011/03/creating-your-own-programming-language.html . In short, a small
I have been working through projects involving packages that do all the web design
I have been working through the tutorial adapting it to a project I want
I am new to cakephp and have been working through the Apress book Beginning
I was turned on to nstrees from another question, and have been working through
I'm new to cakephp so have just been working through the cookbook and am
I'm new to Ruby, and have been working my way through Mr Neighborly's Humble

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.