public Window3(Person person) { InitializeComponent(); var vm = new ViewModelWindow3(person); DataContext = vm; vm.CloseWindowEvent += new System.EventHandler(vm_CloseWindowEvent); }
public ViewModelWindow3(Person person) { People = new List<PocoPerson> { new PocoPerson{ FirstName=person.FirstName, LastName=person.LastName, Age=person.Age }, new PocoPerson{ FirstName="Grace", LastName="Jones", Age=21 }, }; TextProperty1 = "Only this TextBox's changes are reflected in bindings"; NextExampleCommand = new RelayCommand(NextExample); AddUserCommand = new RelayCommand(AddUser); timer = new DispatcherTimer(); timer.Interval = TimeSpan.FromSeconds(1); timer.Tick += new EventHandler(timer_Tick); timer.Start(); }