private void ListViewMenu_SelectionChanged(object sender, SelectionChangedEventArgs e) { UserControl usercontrol = null; GridMain.Children.Clear(); switch (((ListViewItem)((ListView)sender).SelectedItem).Name) { case "MenuQuanLyPhong": usercontrol = new UserControlQuanLyPhong(); GridMain.Children.Add(usercontrol); break; case "MenuQuanLyPhieuThue": usercontrol = new UserControlQuanLyPhieuThue(); GridMain.Children.Add(usercontrol); break; case "MenuBaoCaoThang": usercontrol = new UserControlBaoCaoThang(); GridMain.Children.Add(usercontrol); break; default: break; } }
private void btnHuy_Click(object sender, RoutedEventArgs e) { UserControl usercontrol = new UserControlQuanLyPhieuThue(); Grid gridmain = ((Grid)this.Parent); gridmain.Children.Clear(); gridmain.Children.Add(usercontrol); }