Snoop causes binding to reevaluate... how?

Mar 5, 2014 at 1:51 PM
First, thank you for this awesome tool. I rely on it heavily!
I have question about binding errors that are fixed when I snoop them.

The situation is that when the control is instantiated, the source for the binding is not yet available so I get an error in the output. When I snoop to the control and look at the property with the broken binding it first shows as broken, highlighted in red, as expected. However, when I delve it or change the value of the property (in this case a bool), the binding expression reevaluates and succeeds and from then on my control works as desired.

How is Snoop doing this and how can I do this in my code to create the same effect?

Thanks again!
Mar 6, 2014 at 6:50 AM
This is purely by accident - there is no feature in Snoop that fixes your bindings. Snoop is primarily an inspection tool, and doesn't fix things for you. It just tells you were the errors are. If you have a repro app for this issue, I'd be curious to see it (something tells me that it's a weird binding in your large enterprise app with layers upon layers of UI elements).
Mar 6, 2014 at 1:03 PM
Thanks. I understand that Snoop doesn't fix bindings. I am trying to find exactly what snoop is doing that causes the bindings to be reevaluated in the target property. Because in the case I described, something that snoop did caused the binding to reevaluate and find the source of the binding. I know that the source is not available when my target control is instantiated. The source of the binding has not been instantiated yet. Programatically, for various reasons, I later put the two controls together at which point the binding expression is valid and should be reevaluated successfully.

Specifically I have a user control that has some properties that allow me to add more controls to it. On one of the added controls I have a RelativeSource binding that should be able to find a control in the parent UserControl. It cannot find the source on its own, but when I Snoop it and delve the binding error, suddenly it finds the source and works as expected.

Maybe someone familiar with the source code for Snoop can point me where to look to see exactly what's going on so I can try to do the same thing in my code?
Aug 15, 2014 at 10:54 AM
We're experiencing the same thing. Anybody know where to look in the code to determine where it causes these bindings to kick in?
Jan 21, 2015 at 6:05 PM
Count me in. I am also seeing the same behavior. Obviously snoop got nothing to do with the fix, but we need to figure out why the original binding didn't work until snooped.
Dec 25, 2015 at 5:57 AM
You can use binding expressions:

private void ComboBox_Loaded(object sender, RoutedEventArgs e)
But as Blindmeis noted you can also fire change notifications, further if your collection implements INotifyCollectionChanged (for example implemented in the ObservableCollection<T>) it will synchronize so you do not need to do any of this.

informatica training in chennai | hadoop training in chennai
Apr 16 at 7:59 PM
why are my comments not appearing?