private void Button_Click_1(object sender, RoutedEventArgs e) { VMStudent vm = new VMStudent(); Student stu = new Student(); stu.Name = "zhouqi"; stu.PhotoBitmapImage1 = "E:\\新建文件夹\\5.png"; vm.Students2.Add(stu); vm.Students3.Source = vm.Students2; layoutRoot.DataContext = vm.Students3; //Window2 w2 = new Window2(); //w2.ShowDialog(); }
public Window2() { InitializeComponent(); VMStudent vm = new VMStudent(); layoutRoot.DataContext = vm.Students2; }