private Person GeneratePerson() { var newPerson = new Person { Beard = FlipCoin(), Favorite = FlipCoin(), Goatee = FlipCoin(), Height = randomPosition.NextDouble() + 1, Moustache = FlipCoin(), Name = names[randomPosition.Next(0, names.Count - 1)], BirthDate = DateTime.Now - TimeSpan.FromDays(randomPosition.Next(1, 365 * 20)), }; return newPerson; }
void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e) { _currentPerson = new Person { Beard = false, Favorite = true, Goatee = false, Height = 1.86, Moustache = true, Name = "Jesse", WhichSex = Person.Sex.Male }; ContentPanel.DataContext = _currentPerson; SetDataContext(); Next.Click += Next_Click; }
private void SetDataContext() { ContentPanel.DataContext = GeneratePerson(); _currentPerson = (Person)ContentPanel.DataContext; }
public AddPerson() { InitializeComponent(); p = new Person(); DataContext = p; }