WPF novice practice 4: mvvm light Toolkit (IV. Model, viewmodel, and view)

Source: Internet
Author: User
Tags visual studio 2010

Keywords: WPF. Net C # mvvm light Toolkit framework Visual Studio 2010 vs2010 expression blend 4 getting started tutorial New Practice

4. Model, viewmodel, and view

1. Create a simple model: user, which only contains a string-type attribute userid.

2. In loginviewmodel. CS, add a user-type private member Variable _ currentuser and initialize it in the constructor.

3. to bind to the view layer, I need to wrap the attributes of the model in the viewmodel. Enter "mvvminpc" in loginviewmodel. CS and press the tab key to obtainCodeSegment template. Change the default name to userid.

Delete the private member Variable _ userid and change all access to it to access _ currentuser. userid.

4. In blend 4, bind the text in the "user ID" input box to the userid of loginviewmodel.

Compiled.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.