Example #1
0
        private void erg_tominus1_PreviewTextInput(object sender, System.Windows.Input.TextCompositionEventArgs e)
        {
            e.Handled = CustomHelper.IsDoubleInput(e.Text);
            if (e.Handled)
            {
                return;
            }
            double res = 0.0;

            if (double.TryParse((sender as TextBox).Text, out res))
            {
                if (res < -1.0 || res > 0.0)
                {
                    e.Handled = false;
                }
            }
        }
Example #2
0
        private void erg_tominus1_PreviewTextInput(object sender, TextCompositionEventArgs e)
        {
            e.Handled = CustomHelper.IsDoubleInput(e.Text);
            if (e.Handled)
            {
                return;
            }
            var res     = 0.0;
            var textBox = sender as TextBox;

            if (textBox != null && !double.TryParse(textBox.Text, out res))
            {
                return;
            }
            if (res < -1.0 || res > 0.0)
            {
                e.Handled = false;
            }
        }