/// <summary> /// フォーカス喪失イベント /// </summary> private void OnLeave(object sender, EventArgs e) { if (_NumericDialog != null) { if (_NumericDialog.IsPushNextKey) { SetValue(TextProperty, _NumericDialog.ReturnValue); } _NumericDialog.Close(); _NumericDialog.Dispose(); _NumericDialog = null; } if (_StringDialog != null) { if (_StringDialog.IsPushNextKey) { SetValue(TextProperty, _StringDialog.ReturnValue); } _StringDialog.Close(); _StringDialog.Dispose(); _StringDialog = null; } Background = Brushes.White; }
private void QtyButton_OnClick(object sender, RoutedEventArgs e) { var num = new NumericKeyboard(0, 10); num.SubmitNumber += (o, args) => ((ContentControl)sender).Content = args.Value; num.ShowDialog(); }
/// <summary> /// 終了処理 /// </summary> public void Dispose() { if (_NumericDialog != null) { _NumericDialog.Dispose(); _NumericDialog = null; } if (_StringDialog != null) { _StringDialog.Dispose(); _StringDialog = null; } GotFocus -= OnEnter; LostFocus -= OnLeave; }
/// <summary> /// フォーカス取得イベント /// </summary> private void OnEnter(object sender, EventArgs e) { Point point = PointToScreen(new Point(0d, 0d)); // テンキー表示 if (IsUseNumericKeyboard) { _NumericDialog = new NumericKeyboard((string)GetValue(TextProperty), point.X, point.Y, ActualHeight, ActualWidth) { Owner = Window.GetWindow(this) }; _NumericDialog.Show(); } else if (IsUseStringKeyboard) { _StringDialog = new StringKeyboard((string)GetValue(TextProperty), point.X, point.Y, ActualHeight, ActualWidth) { Owner = Window.GetWindow(this) }; _StringDialog.Show(); } Background = Brushes.Yellow; }