I have xaml file:
<TextBox Text="{Binding Student.SName, Mode=TwoWay}"/>
<TextBox Text="{Binding Student.Name, Mode=TwoWay}"/>
And my Definition to this xaml file:
public Model.Student Student { get; set; }
And the Student
Class which is in the property:
public class Student : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
private string _SName;
private string _Name;
public string SName
{
get { return _SName; }
set
{
if (_SName != value)
{
_SName = value;
OnPropertyChanged("SName");
}
}
}
public string Name
{
get { return _Name; }
set
{
if (_Name != value)
{
_Name = value;
OnPropertyChanged("Name");
}
}
}
}
What can I do, to change the value in the Student-Property automatically when entering text?