using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace DTS.Common.Controls { /// /// Interaction logic for ISOPopup.xaml /// public partial class ISOPopup : Popup { public ISOPopup() { InitializeComponent(); } private void ISOPart_OnPreviewKeyUp(object sender, KeyEventArgs e) { bool isAlpha = (e.Key >= Key.A && e.Key <= Key.Z); bool isNumPadNumeric = (e.Key >= Key.NumPad0 && e.Key <= Key.NumPad9); bool isNumeric = (e.Key >= Key.D0 && e.Key <= Key.D9); bool isControl = e.Key == Key.Enter || e.Key == Key.Return || e.Key == Key.Tab || e.Key == Key.OemBackTab || e.Key == Key.Delete || e.Key == Key.Back || e.Key == Key.Home || e.Key == Key.End; e.Handled = !(e.Key == Key.OemQuestion || isAlpha || isNumPadNumeric || isNumeric || isControl); } private void ISOPart_OnGotMouseCapture(object sender, MouseEventArgs e) { if (sender is TextBox tb) { tb.SelectAll(); } } private void ISOPart_OnGotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) { if (sender is TextBox tb) { tb.SelectAll(); } } } }