New WPF Practice 3: mvvm light Toolkit (3. 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

3. viewmodel and view

Next, I plan to use the viewmodel OF THE mvvm light Toolkit framework on the simplest login logon interface.

1. Add a new item to the viewmodel directory of the merged project, select the "mvvmviewmodel (WPF)" file template, and name it loginviewmodel. CS.

2. Open viewmodellocator. Cs in the viewmodel directory, start a new line under the constructor, enter "mvvmlocatorproperty", press the tab key, get the code snippet template, and change the default name to loginviewmodel.

3. After completing the code snippet template, delete the redundant cleanup () method (if any) and the original constructor and cleanup () add the corresponding create and clear methods to the method.

4. the login logon interface for view is implemented by page. In blend 4, open loginpage. XAML and bind its datacontext to loginviewmodel, as shown in the following two figures.

Compiled.

Author: Li fengtong; Source: http://www.cnblogs.com/phoenixtrees. Http://www.cnblogs.com/phoenixtrees/archive/2011/05/03/2034892.html

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

3. viewmodel and view

Next, I plan to use the viewmodel OF THE mvvm light Toolkit framework on the simplest login logon interface.

1. Add a new item to the viewmodel directory of the merged project, select the "mvvmviewmodel (WPF)" file template, and name it loginviewmodel. CS.

2. Open viewmodellocator. Cs in the viewmodel directory, start a new line under the constructor, enter "mvvmlocatorproperty", press the tab key, get the code snippet template, and change the default name to loginviewmodel.

3. After completing the code snippet template, delete the redundant cleanup () method (if any) and the original constructor and cleanup () add the corresponding create and clear methods to the method.

4. the login logon interface for view is implemented by page. In blend 4, open loginpage. XAML and bind its datacontext to loginviewmodel, as shown in the following two figures.

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.