Windows Phone: mvvm light Toolkit

Source: Internet
Author: User

Mvvm light toolkit is the most widely used mvvm framework in Silverlight development. Although some development efforts have been made in this area, it has not been well studied. Today we will do a systematic study, record for future reference (mainly because E is too bad to read ).

For the latest message about mvvm light toolkit, see http://mvvmlight.codeplex.com/

1. Download and install

The basic requirements will not be said, you can refer to: http://www.galasoft.ch/mvvm/installing/ "installation prerequisites" section.

If you have installed other versions before, uninstall them first, refer to: http://www.galasoft.ch/mvvm/cleaning/

I installed mvvm light toolkit V4 beta 1 (: http://mvvmlight.codeplex.com/releases/view/73208), installed after the download is complete, in addition to changing the installation path to the appropriate place, other options are default settings. Process

2. Introduction

Galasoft. mvvmlight class library

  • The viewmodelbase class is the basic class of viewmodels. in development, the viewmodls class must inherit from it.
  • The messenger class is used for Application Communication. The receiver only accepts the registered message type. In addition, the target type can be specified and implemented by sending <tmessgae, ttarget> (tmessage message). In this case, if the receiver type matches the target parameter type, A message can be any object and can be inherited from a specific message type or its own type.
    1. Messagebase: the message base class, which is any information of the message publisher.
    2. Genericmessage <t>: A simple generic message.
    3. Icationicationmessage: used to send a string-type notification to the recipient.
    4. Icationicationmessage <t>: icationicationmessage generic operator.
    5. Icationicationmessage: sends a notification to the receiver, allowing the receiver to send a message to the sender.
    6. Notificationmessageaction <t>: the generic method of icationicationmessage.
    7. Dialogmessage: the sender (usually view) displays the dialog, and transmits the callback result (used for callback). The receiver can select how to display the dialog box, it can be either a standard MessageBox or a custom pop-up window.
    8. Propertychangedmessage <t>: it is used to broadcast the change of an attribute in the sender. It has a complete box with the propertychanged event, but it is a weak contact method.
  • The command class is the best way to use in your application. You can use relaycommand <t> and relaycommand to easily bind an execution command.

 Galasoft. mvvmlight. Extras class libraryOptional

  Eventtocommand BehaviorAllows you to bind any event to the UI element. It must be an icommand.

  Dispatcherhelper classA lightweight class that can be used for multithreaded programming (asynchronous processing ).

3. Template

After the mvvm light toolkit is installed, various mvvm project templates (depending on whether you have installed the platform) will appear when you create a new project ),

Various templates are also available when you create an item,

However, if you create an mvvmviewmodel (WP7, other types are not tested), you must manually register it in viewmodellocator. CS.

4. code snippets

Developers can perform development faster, but only supported in. Blend is unavailable.

Now I have a preliminary understanding, and I will find new functions later.

 

 

 

 

 

Related Article

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.