private void TextBox_LostFocus(object sender, RoutedEventArgs e) { EditingStatusChangedEventArgs arg = new EditingStatusChangedEventArgs(false); EditingStatusChanged?.Invoke(this, arg); if (!arg.Handled) { base.IsReadOnly = true; } }
private void TextBox_MouseDoubleClick(object sender, MouseButtonEventArgs e) { EditingStatusChangedEventArgs arg = new EditingStatusChangedEventArgs(true); EditingStatusChanged?.Invoke(this, arg); if (!arg.Handled) { base.IsReadOnly = false; Select(Text.Length, 0); Focus(); } }
private void TextBox_PreviewKeyDown(object sender, KeyEventArgs e) { EditingStatusChangedEventArgs arg = new EditingStatusChangedEventArgs(false); EditingStatusChanged?.Invoke(this, arg); if (!arg.Handled) { if (e.Key == Key.Enter && !AcceptsReturn) { Keyboard.ClearFocus(); base.IsReadOnly = true; } } }