Keywords: WPF. Net C # mvvm light Toolkit framework Visual Studio 2010 vs2010 expression blend 4 getting started tutorial New Practice
V. Command
1. In loginviewmodel. CS, add the relaycommand attribute logincommand as the command object in response to the view-layer logon operation.
2. initialize the logincommand object in the loginviewmodel constructor.
When creating a logincommand object, two parameters are specified: Login () and canlogin (), these two methods are used to perform the login operation and determine whether the login operation can be performed (actually corresponding to the execute and canexecute of icommand ). The following describes the specific implementation of login () and canlogin.
3. In blend 4, select "behavior" from the list on the "assets" tab, drag "eventtocommand" to the logon button, and change the default name to loginbuttonclick.
4. Bind the command attribute of loginbuttonclick to logincommand, 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/05/2037676.html
Keywords: WPF. Net C # mvvm light Toolkit framework Visual Studio 2010 vs2010 expression blend 4 getting started tutorial New Practice
V. Command
1. In loginviewmodel. CS, add the relaycommand attribute logincommand as the command object in response to the view-layer logon operation.
2. initialize the logincommand object in the loginviewmodel constructor.
When creating a logincommand object, two parameters are specified: Login () and canlogin (), these two methods are used to perform the login operation and determine whether the login operation can be performed (actually corresponding to the execute and canexecute of icommand ). The following describes the specific implementation of login () and canlogin.
3. In blend 4, select "behavior" from the list on the "assets" tab, drag "eventtocommand" to the logon button, and change the default name to loginbuttonclick.
4. Bind the command attribute of loginbuttonclick to logincommand, as shown in the following two figures.
Compiled.