private void IncreaseValue() { if (NumValue == 0) { NumTxt.SetEdit(); } NumValue++; }
private void DecreaseValue() { if (NumValue - 1 > 0) { NumValue--; } else if (NumValue - 1 == 0) { NumTxt.SetHint(); ValueChanged(this, new EventArgs()); } }
private void NumTxt_TextChanged(object sender, TextChangedEventArgs e) { // if the text can be parse as integer, apply it to the textbox if (int.TryParse(NumTxt.Text, out numValue)) { NumTxt.Text = numValue.ToString(); } else if (String.IsNullOrEmpty(NumTxt.Text)) { NumTxt.Text = ""; } // keep the textbox old value else { NumTxt.Text = text; } // if the textbox value is 0, set the hint if (NumTxt.Text == "0") { NumTxt.SetHint(); } }