Saturday 15 May 2010

c# - Correctly Using CanExecute for MVVM Light ICommand -


I am starting to learn MVVM in C # and I was wondering how to use the canxax method for an ICMMand in MVVML Lite properly. My WPF application VS 2012 is in C # 4.5 Framework.

How can properly implement canuckschitch?

I am just returning the truth, but I know that there is a proper way to handle it. Maybe

  if (parameter! = Null) {back true; }   

Here is some sample code.

  Send Private Relay Commands; Send public ICommand SendCommand {if (sendCommand == blank) Command = new relay command (P = & amp;; SendStuffMethod (P), P = & gt; CanSendStuff (P)); Send a returnComment; }} Private Bull CanSendStuff (object parameter) {return true; } Private Zero SendStuffMethod (object parameter) {string [] sample = (string []) parameter; Foreach (different specimens in samples) {// Execute Stuff}}    

  bool canseendstuff (object parameter); // // Summary: // When the command is implemented, the method defines the call. Data used by // // parameter: // parameter: // command If the command does not need to pass data, then // can be set to clear this object. Zero executed (object parameter);    

No comments:

Post a Comment