views:

44

answers:

2

Can I force a window to re-evaluate all of its bindings and validations?

For some reason it seems to be ignoring the INotifyPropertyChanged.PropertyChanged in one weird situation and I'm looking for a work-around to use until I find the real cause.

+2  A: 

Unfortunately, I know of no way to force every binding within a window to re-evaluate. Part of the problem is that most of the bindings aren't declared on the Window, but rather on specific DependencyObject children of the Window.

You can use DependencyObject.InvalidateProperty to invalidate a single binding, but this must be done on a property by property basis. If there is only a few objects being bound, you should be able to use this to force a requery of their values.

That being said, I would suggest figuring out the root cause - it's likely to be a better solution in the long run.

Reed Copsey
+1  A: 

Raise PropertyChanged with String.Empty as the property name. This will cause all bindings in the object to reread all its bindings.

If you are having binding issues dont forget to check your Output window for binding errors

benPearce