xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras"
Secondly, add "EventToCommand" behavior within any element that you need.In ElementName, you can link to any other element of the page (in the above example, lstSearchResults is the name of a listbox that include this button). With DataContext, we can obtain the datacontext of any element.
/// SUMMARY
/// Command to register a new patient.
/// SUMMARY
public RelayCommand RegisterNewPatientCommand
{
get;
private set;
}
/// SUMMARY
/// Command to open the patient banner to view the patient details.
/// SUMMARY
public RelayCommand<PATIENT> LoadPatientBannerCommand
{
get;
private set;
}
In ViewModel class, you have to define the Commanding Finally, in the constructor of the viewmodel class, you need to initialize the commands:this.RegisterNewPatientCommand = new RelayCommand(() => this.PreLoadRegisterPatientModule());
this.LoadPatientBannerCommand = new RelayCommand<PATIENT>((pat) => this.LoadPatientBanner(pat));
Source: http://blog.galasoft.ch/
No hay comentarios:
Publicar un comentario