void t_GotFocus(object sender, RoutedEventArgs e) { if (t != null) { MyTextBox.Focus(); } }
public MyDialogWindow(Window owner) { InitializeComponent(); this.Owner = owner; MyTextBox.Focus(); MyTextBox.KeyDown += MyTextBox_KeyDown; }
//back space button private void Button_Click_2(object sender, RoutedEventArgs e) { string text = MyTextBox.Text; MyTextBox.Text = text.Substring(0, text.Length - 1); MyTextBox.Focus(); }
void textBox_LostFocus(object sender, RoutedEventArgs e) { if (Field == Big3.Hitbase.DataBaseEngine.Field.Price) { SaveControlData(); UpdateControlData(); } if (Field == Field.ArtistCDName) { hitbaseMainWindowControl.UpdateAllControls(); } if (Field == Field.ArchiveNumber) { if (Configuration.Settings.Current.NoDuplicateArchiveNumbers) { int recordFound = hitbaseMainWindowControl.DataBase.CheckArchiveNumber(textBox.Text); if (recordFound > 0 && recordFound != hitbaseMainWindowControl.theCd.ID) // Doppelte Archiv-Nummer gefunden!! { MessageBox.Show(StringTable.ArchiveNumberAlreadyExists, System.Windows.Forms.Application.ProductName, MessageBoxButton.OK, MessageBoxImage.Information); textBox.Focus(); } } } }
private void MyPopup_GotFocus(object sender, RoutedEventArgs e) { var source = (HwndSource)PresentationSource.FromVisual(MyPopup.Child); if (source != null) { SetFocus(source.Handle); MyTextBox.Focus(); } }
private void btnAddRow_Click(object sender, EventArgs e) { MyTextBox.SelectionChanged -= richTextBox_SelectionChanged; var tabTemp = tabControlMain.SelectedTab; var index = MyTextBox.GetFirstCharIndexOfCurrentLine(); var insertText = GetSelectedTabsString(); if (!MyTextDataAdapter.HasCrLf) { insertText = insertText + "\r\n"; } var nextIndex = index + insertText.Length; MyTextBox.Text = MyTextBox.Text.Insert(index, insertText); MyTextBox.SelectionStart = nextIndex; tabControlMain.SelectedTab = tabTemp; MyTextBox.SelectionChanged += richTextBox_SelectionChanged; MyTextBox.Focus(); }
private void InitCustomLayout() { var list = TupleList(); foreach (Tuple <string, Grid> tuple in list) { // create a char array from string char[] charArray = tuple.Item1.ToCharArray(); // add cells to the grid foreach (char a in charArray) { tuple.Item2.ColumnDefinitions.Add(new ColumnDefinition()); } // for loop - create button with all the properties and asign an [EventHandler] for (int i = 0; i < charArray.Length; i++) { Button button = new Button(); button.Width = 30.0; button.Height = 30.0; button.Content = charArray[i].ToString(); button.Click += new RoutedEventHandler(OnClick); Grid.SetColumn(button, i); tuple.Item2.Children.Add(button); } } void OnClick(object sender, RoutedEventArgs e) { Button button = (Button)sender; MyTextBox.AppendText((string)button.Content); MyTextBox.Focus(); } }
public void FocusText() { MyTextBox.Focus(); }
// space button private void Button_Click_1(object sender, RoutedEventArgs e) { MyTextBox.AppendText(" "); MyTextBox.Focus(); }
public MyDialogWindow() { InitializeComponent(); MyTextBox.Focus(); MyTextBox.KeyDown += MyTextBox_KeyDown; }
private void Window_Loaded(object sender, RoutedEventArgs e) { MyTextBox.Document = (FlowDocument)XamlReader.Parse(UserString); MyTextBox.Focus(); MyTextBox.SelectAll(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { MyTextBox.Text = UserString; MyTextBox.Focus(); MyTextBox.SelectAll(); }
private void Grid_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e) { m_Model.Editing = true; MyTextBox.Focus(FocusState.Programmatic); }