private void HostComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { int index = HostComboBox.SelectedIndex; switch (index) { case 0: MainGrid.Children.RemoveRange(1, 3); AddHostingUnit_UserControl add_uc = new AddHostingUnit_UserControl(); MainGrid.Children.Add(add_uc); Grid.SetRow(add_uc, 1); //? Grid.SetColumn(add_uc, 1); //? break; case 1: MainGrid.Children.RemoveRange(1, 3); UpdateHostingUnit_UserControl Update_uc = new UpdateHostingUnit_UserControl(); MainGrid.Children.Add(Update_uc); Grid.SetRow(Update_uc, 1); //? Grid.SetColumn(Update_uc, 1); //? break; case 2: MainGrid.Children.RemoveRange(1, 3); DeleteHostingUnit_UserControl Delete_uc = new DeleteHostingUnit_UserControl(); MainGrid.Children.Add(Delete_uc); Grid.SetRow(Delete_uc, 1); //? Grid.SetColumn(Delete_uc, 1); //? break; default: break; } }
private void UpdateUnitButton_Click(object sender, RoutedEventArgs e) { MainGrid.Children.RemoveRange(1, 3); UpdateHostingUnit_UserControl update_uc = new UpdateHostingUnit_UserControl(); MainGrid.Children.Add(update_uc); Grid.SetRow(update_uc, 1); //? Grid.SetColumn(update_uc, 1); //? }