예제 #1
0
        private void Jmeno_TextChanged(object sender, TextChangedEventArgs e)
        {
            clovek.AddName(Jmeno.Text);

            if (!ValidationExtension.Validate(validator, clovek, "Name").IsValid)
            {
                Jmeno.Background = Brushes.Red;
            }
            else
            {
                Jmeno.Background = Brushes.White;
            }
        }
예제 #2
0
        /*private void Button_Click(object sender, RoutedEventArgs e)
         * {
         *  Person clovek = new Person
         *  {
         *      Name = Jmeno.Text,
         *      Surname = Prijmeni.Text,
         *      Email = Email.Text
         *  };
         *
         *  if (!ValidationExtension.Validate(validator, clovek, "Surname").IsValid)
         *  {
         *      Prijmeni.Background = Brushes.Red;
         *  }
         *  if (!ValidationExtension.Validate(validator, clovek, "Name").IsValid)
         *  {
         *      Jmeno.Background = Brushes.Red;
         *  }
         *
         *  if (ValidationExtension.Validate(validator, clovek, "Email").IsValid)
         *  {
         *      Email.Background = Brushes.White;
         *  }
         *  if (ValidationExtension.Validate(validator, clovek, "Surname").IsValid)
         *  {
         *      Prijmeni.Background = Brushes.White;
         *  }
         *  if (ValidationExtension.Validate(validator, clovek, "Name").IsValid)
         *  {
         *      Jmeno.Background = Brushes.White;
         *  }
         *
         * }*/

        private void Email_TextChanged(object sender, TextChangedEventArgs e)
        {
            clovek.AddEmail(Email.Text);

            if (!ValidationExtension.Validate(validator, clovek, "Email").IsValid)
            {
                Email.Background = Brushes.Red;
            }
            else
            {
                Email.Background = Brushes.White;
            }
        }