void TextBOX_TextChanged(object sender, TextChangedEventArgs e) { if (string.IsNullOrWhiteSpace(TextBOX.Text)) return; try { Value = int.Parse(TextBOX.Text); } catch { Value = Last; } if (Value > Maximum) Value = Maximum; else if (Value < Minimum) Value = Minimum; Last = Value; }