void MainPage_Loaded(object sender, RoutedEventArgs e) { if (this.currentMain_ViewModel == null) this.currentMain_ViewModel = new MainPage_ViewModel(); this.currentMain_ViewModel.LoadDefaultCatalogData(); this.DataContext = currentMain_ViewModel; }
public void DataColIsChanged_Test() { bool isPropertyChanged = false; MainPage_ViewModel currentViewModel = new MainPage_ViewModel(); currentViewModel.PropertyChanged += (x, se) => { if (currentViewModel.CatalogInfoCol.Count > 0) isPropertyChanged = true; }; currentViewModel.CatalogInfoCol = new System.Collections.ObjectModel.ObservableCollection<CatalogInfor>() { new CatalogInfor(){CatalogTitle="ComplateTestChanged",CatalogComment="TestData"} }; Assert.IsTrue(isPropertyChanged); }