public MainWindow() { InitializeComponent(); UserControl usc = new DeviceSetting(); GridMain.Children.Add(usc); }
//更換List的列表 private void ListViewMenu_SelectionChanged(object sender, SelectionChangedEventArgs e) { UserControl usc = null; GridMain.Children.Clear(); Console.WriteLine(((ListViewItem)((ListView)sender).SelectedItem).Name); switch (((ListViewItem)((ListView)sender).SelectedItem).Name) { case "Download": usc = new DeviceSetting(); GridMain.Children.Add(usc); break; case "DialyRecord": usc = new DialyRecord(); GridMain.Children.Add(usc); break; case "PhysicalActivity": usc = new PhysicalActivity(); GridMain.Children.Add(usc); break; case "Sleep": usc = new Sleep(); GridMain.Children.Add(usc); break; case "Report": usc = new SleepReport(); GridMain.Children.Add(usc); break; default: break; } }