bugfixr
bugfixr

Reputation: 8077

INotifyPropertyChanged when binding to object itself instead of a property

I'm doing some binding in Windows Phone 8's WPF form. I've got a list bound to the object itself:

{Binding .}

That object implements the INotifyPropertyChanged interface. In a scenario where I bind to a property on that object:

{Binding someProperty}

I can call the property changed event and my list will be updated. However, in the case that I'm bound to my object itself, how can I notify the list that the object changed?

Upvotes: 3

Views: 803

Answers (1)

NSGaga
NSGaga

Reputation: 14302

A short answer is...

1) If you want for it to update - and INotify... to work - you either need to reorganize your view-models a bit - and bind to a property - of a 'parent view model'.

2) Or you could make up one 'temp property' - e.g.
public YourObject MySelf {get{return this;}set{}}

3) Or in some cases (depends on what you have) you could use MultiBinding with {Binding .} (this) and some other property - which is then 'notified' (the other property).

I've described this in some more details here (point #4)
refreshing Value Converter on INotifyPropertyChanged

Upvotes: 6

Related Questions