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 AddUnitButton_Click(object sender, RoutedEventArgs e) { MainGrid.Children.RemoveRange(1, 3); AddHostingUnit_UserControl add_uc = new AddHostingUnit_UserControl(host); MainGrid.Children.Add(add_uc); Grid.SetRow(add_uc, 1); //? Grid.SetColumn(add_uc, 1); //? }
private void SaveHostDetails_Click(object sender, RoutedEventArgs e) { BankNameTextBox.GetBindingExpression(TextBox.TextProperty).UpdateSource(); BankNumTextBox.GetBindingExpression(TextBox.TextProperty).UpdateSource(); BranchNumberTextBox.GetBindingExpression(TextBox.TextProperty).UpdateSource(); BranchAddressTextBox.GetBindingExpression(TextBox.TextProperty).UpdateSource(); BankAccountNumberTextBox.GetBindingExpression(TextBox.TextProperty).UpdateSource(); //hostingUnit.Owner.BankBranchDetails.CollectionClearance = (CollectionClearanceCheckBox.IsChecked); AddHostingUnit_UserControl addHostingUnit_UserControl = new AddHostingUnit_UserControl(hostingUnit); (this.Parent as StackPanel).Children.Add(addHostingUnit_UserControl); (this.Parent as StackPanel).Children.Remove(this); }