public AllDiary() { InitializeComponent(); _allDiaryModel = new allDiaryModel(); this.dataGrid.DataContext = _allDiaryModel.mylist; // Console.WriteLine("界面mylist"); // Console.WriteLine(_allDiaryModel.mylist.Count); }
public MainWindow() { InitializeComponent(); _allDiaryPage = new page.allDiaryModel(); this.DataContext = _allDiaryPage; //添加页面的Uri地址,采用相对路径,根路径是项目名,实现allViews的初始化 allViews.Add("page1", new Uri("page/AllDiary.xaml", UriKind.Relative)); allViews.Add("page2", new Uri("page/AddDiary.xaml", UriKind.Relative)); // mainFrame.Navigate(allViews["page1"]); }