1

Possible Duplicate:
Why does the binding update without implementing INotifyPropertyChanged?

I have WPF:

    <TextBlock Grid.Row="0" Text="{Binding SomeProperty}" />
    <TextBox Grid.Row="1" Text="{Binding SomeProperty, UpdateSourceTrigger=PropertyChanged}" />

Bound to

class MyModel1
{
    string _someProperty = string.Empty;
    public string SomeProperty
    {
        get { return _someProperty; }
        set { _someProperty = value; }
    }
}

It allso works with:

    class MyModel
        {
            public string SomeProperty { get; set; }
        }

As You see there is no Property Change notifications, but TextBlock is updated while i am typing to TextBox. I am using Visual C# express 2010, standard WPF app project template, standard contols, no snippets, nothing additional, with .NET 4 client profile.

  • Question 1: Why it works?
  • Question 2: Is that new feature of .NET 4?
  • Question 3: How I could get notifications about property changes from my code without implementing any events in my model?

Thank You

Community
  • 1
  • 1
Dule
  • 13
  • 2

1 Answers1

0

1 if that's work, WPF's data binding engine will data bind to PropertyDescriptor instance which wraps the source property if the source object is a plain CLR object and doesn't implement INotifyPropertyChanged interface.

PropertyDescriptor.AddValueChanged() method permit to subscribe to notification.

The change is not synchronized as desired, we use INotifyPropertyChanged in order to customize this aspect.

2 You can read this article it's interessant

Link : http://msdn.microsoft.com/en-us/library/bb613588.aspx

Aghilas Yakoub
  • 28,516
  • 5
  • 46
  • 51
  • Thank You very much. With Your supplied keyword I found that this thing was allready discussed here [link](http://stackoverflow.com/questions/7767218/why-does-the-binding-update-without-implementing-inotifypropertychanged) – Dule Sep 08 '12 at 12:56
  • I'am happy to help you Dule, if you have another question i tried to help – Aghilas Yakoub Sep 08 '12 at 12:57