Created
November 20, 2015 15:55
-
-
Save asimmon/dca757f49da463b831f9 to your computer and use it in GitHub Desktop.
EventToCommand Xamarin Forms - Example ViewModel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class HomeViewModel : ViewModelBase | |
{ | |
public ObservableCollection<PersonViewModel> People { get; set; } | |
public RelayCommand<PersonViewModel> SayHelloCommand { get; set; } | |
public HomeViewModel() | |
{ | |
People = new ObservableCollection<PersonViewModel> | |
{ | |
new PersonViewModel("John"), | |
new PersonViewModel("Mike"), | |
new PersonViewModel("Jane") | |
}; | |
SayHelloCommand = new RelayCommand<PersonViewModel>(SayHello); | |
} | |
public void SayHello(PersonViewModel person) | |
{ | |
Debug.WriteLine("Hello {0}!", person.Name); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment