private void AddGroupButton_Click(object sender, RoutedEventArgs e) { NewGroupStackPanel.Visibility = Visibility.Visible; ShowWorkersViewButton.IsEnabled = false; NewGroupNameTextBox.Text = string.Empty; NewGroupNameTextBox.Focus(); }
private void OKAddGroupButton_Click(object sender, RoutedEventArgs e) { if (NewGroupNameTextBox.Text.Trim() == string.Empty) { NewGroupNameTextBox.Focus(); return; } if (!BindingOperations.IsDataBound(NewGroupNameTextBox, TextBox.TextProperty)) { _mwc.AddMyWorkersGroup(AdministrationClass.CurrentWorkerId, NewGroupNameTextBox.Text.Trim()); } else { _mwc.SaveMyWorkers(); } MyWorkersGroupComboBox.SelectedIndex = 0; CancelAddGroupButton_Click(null, null); }
private void EditGroupButton_Click(object sender, RoutedEventArgs e) { if (MyWorkersGroupComboBox.Items.Count == 0) { return; } if (MyWorkersGroupComboBox.SelectedItem == null) { return; } NewGroupStackPanel.Visibility = Visibility.Visible; ShowWorkersViewButton.IsEnabled = false; NewGroupNameTextBox.Text = string.Empty; NewGroupNameTextBox.Focus(); var myBinding = new Binding("MyWorkerGroupName") { Mode = BindingMode.TwoWay }; NewGroupNameTextBox.SetBinding(TextBox.TextProperty, myBinding); NewGroupNameTextBox.DataContext = MyWorkersGroupComboBox.SelectedItem; }