private void ScannerOnMouseDown(object sender, MouseButtonEventArgs e) { e.Handled = true; var focus = TextNumbers.Focus(); Debug.WriteLine($"{sender} ScannerOnMouseDown {e.ChangedButton}, focus: {focus}"); TextNumbers.SelectAll(); // SelectAllNumbers(); }
// private static Size MeasureString(string candidate, TextBlock textBlock) // { // var formattedText = new FormattedText( // candidate, // CultureInfo.CurrentCulture, // FlowDirection.LeftToRight, // new Typeface(textBlock.FontFamily, textBlock.FontStyle, textBlock.FontWeight, textBlock.FontStretch), // textBlock.FontSize, // _brushForeground, // new NumberSubstitution(), // 1); // return new Size(formattedText.Width, formattedText.Height); // } private void SetValueFromInput() { var input = TextNumbers.Text; input = input.Replace(',', '.'); if (!double.TryParse(input, NumberStyles.Float, CultureInfo.InvariantCulture, out var val)) { TextNumbers.Text = Value.ToString(CultureInfo.InvariantCulture); return; } Value = val; TextNumbers.SelectAll(); //SelectAllNumbers(); }