You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
1.5 KiB

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BindingValidationRuleSample.Model
{
public class Student : INotifyPropertyChanged
{
private string _name;
private string _age;
private string _phoneNumber;
public event PropertyChangedEventHandler? PropertyChanged;
public Student(string name, string age, string number)
{
}
public Student() : this("Name", "20", "123-456-7890")
{
}
public string Name
{
get { return _name; }
set
{
_name = value;
OnPropertyChanged(nameof(this.Name));
}
}
public string Age
{
get { return _age; }
set
{
_age = value;
OnPropertyChanged(nameof(this.Age));
}
}
public string PhoneNumber
{
get { return _phoneNumber; }
set
{
_phoneNumber = value;
OnPropertyChanged(nameof(this.PhoneNumber));
}
}
private void OnPropertyChanged(string propertyName)
{
if (this.PropertyChanged == null)
return;
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
}