// Constructor public MainViewModel() { People = new ObservableCollection <Person>(); Person Josh = new Person("Josh"); Josh.Age = 23; Person Gabriella = new Person("Gabriella"); Gabriella.Age = 24; Gabriella.Birthday = new DateTime(1995, 04, 03); Person Someone = new Person("Someone"); Someone.Age = 13; People.Add(Josh); People.Add(Gabriella); People.Add(Someone); SelectedPerson = People[new Random().Next(People.Count - 1)]; LeftViewModel = new EditViewModel(this); RightViewModel = new DisplayViewModel(this); SwapView = new MyICommand(OnSwapView, CanSwapView); }
public MainViewModel() { People = new ObservableCollection <Person> { new Person("Josh") { Age = 23 }, new Person("Someone") { Age = 13 }, new Person("Gabriella") { Age = 24, Birthday = new DateTime(1995, 04, 03) } }; SelectedPerson = People[new Random().Next(People.Count - 1)]; LeftViewModel = new EditViewModel(this); RightViewModel = new DisplayViewModel(this); SwapView = new MyICommand(OnSwapView, CanSwapView); }