WPF Commands

First Create a Delegate in ViewModel as a declaration:

public DelegateCommand Deploy { get; set; } 

Next create the method you are going to call:

//Deploy Module Clicked - This one takes ro_clientmodules_extend from my grid!
private void Deploy_click(ro_clientmodules_extend obj)
{

}

Next sort out the viewmodel constructor:

public LicenseDeploymentModuleViewModel()
{
   Deploy = new DelegateCommand(Deploy_click);
}

Finally deal with the XAML:

Note: Mine is inside the Datagrid as a button on a row. Yours may need adjusting to tweek the relative path!
Note2: Mine is also bound to an enable or disable variable.


If you remove the references to ro_clientmodules_extend then you don’t need the complex additions to the binding although you will not then pass the variable back to the command procedure which could limit what you can do.. hence I left it in as an example.

Leave a Reply

Your email address will not be published. Required fields are marked *