Checking text box input on a Windows 7 phone

I am new to the Windows Phone 7 development platform. I am trying to run a check to enter a text box. When debugging, in case of invalid input, I get the error "exception was not processed." How to fix this? This code is great for the silverlight application.

TextBox Text="{Binding Name, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnExceptions=True}" />

private string _name;  
public String Name  
        {  
            get   {   return _name; }  
            set {

                if (string.IsNullOrEmpty(value))
                {
                    throw new Exception("invalid name");
                }
                _name = value;
                OnPropertyChanged("Name");
            }
        }
+3
source share
2 answers

Have you tried to catch an exception invalid namewhile trying to set an invalid value?

+1
source

I had the same problem and found the following answer:

viewmodel, . , .

+1

Source: https://habr.com/ru/post/1763298/


All Articles