Property binding is easy to mistake property names. If you mistake property name, you can't bind property correctly but also an application suddenly crashes without any errors.
So, please look at this code attentively. If you write such code, you can pass build action, but your application crashes suddenly without errors.
public class ItemProperties : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public ItemProperties() { }
private string m_Text1;
public string Text1
{
get { return Text1; }
set
{
m_Text1 = value;
OnPropertyChanged("Text1");
}
}
protected void OnPropertyChanged(string name)
{
PropertyChangedEventHandler handler = this.PropertyChanged;
if (handler != null)
handler(this, new PropertyChangedEventArgs(name));
}
}
The wrong code is here. If you write like this, your application suddenly shutdown.
get { return Text1; }
You need to write like this.get { return m_Text1; }
I don't know why debugger can't catch error, but I noticed we need to pay attention when we use property binding.






