Groups | Blog | Home
all groups > dotnet windows forms > february 2007 >

dotnet windows forms : PropertyGrid and INotifyPropertyChanged problem


Chris
2/7/2007 3:09:46 AM
Hi,

I've got a problem with the PropertyGrid and the
INotifyPropertyChanged interface. I have a class that implements the
INotifyPropertyChanged and raises the PropertyChanged when a property
of this class is changed. My PropertyGrid is connected to this object
through the SelectedObject property.

My problem is that the PropertyGrid does not get updated when the
object's property value is changed. I can see that the
INotifyPropertyChanged.PropertyChanged is null which means that the
PropertyGrid is not attached to this event.

How can I make the PropertyGrid listen to
INotifyPropertyChanged.PropertyChanged events?

Best regards,
Chris
VisualHint
2/7/2007 5:23:16 AM
Hello Chris,

Look at the answer of Linda in this thread:

http://groups.google.com/group/microsoft.public.dotnet.framework.windowsforms/browse_thread/thread/a2f96848880e8788/e8dfa4ce1e3b8b8a

Best regards,

Nicolas Cadilhac @ VisualHint (http://www.visualhint.com)
Home of Smart PropertyGrid for .Net and MFC
Microsoft PropertyGrid Resource List - http://
www.propertygridresourcelist.com



[quoted text, click to view]

Chris
2/8/2007 3:48:58 AM
Hi Nicolas,

thanks for your posting.

Linda's solution seems to work, but only if there are other bindings
active. If the PropertyGrid and the DemoCustomer are the only citizens
on a Form, the PropertyGrid update still doesn't work when a
DemoCustomer property is modified. But if you add additional databound
controls to the form that are bound to any property of the
DemoCustomer object, also the PropertyGrid is getting updated. Very
strange behaviour.

Best regards,
Chris
AddThis Social Bookmark Button