views:

78

answers:

2

Hello, I've got a strange problem - binding created through XAML (both ways by markup extension or normal) isn't working(BindingOperations.IsDataBound returns false and in fact there is no Binding object created). When I do literally the same from code everything is working perfectly.

One more thing is that the Binding in XAML is created in a DataTemplate - what's funny about that when I use the DataTemplate for the first time it fails, then I fix it from code (add binding to specific objects) and while adding more objects to the collection the binding set in XAML just works. If I try to remove all the objects from the collection and then add a new one the binding fails once again.

In reality this is a shortened version of another of my questions. For details please refer to: http://stackoverflow.com/questions/2986511/wpf-debugging-avalonedit-binding-to-document-property

Sorry for doing it this way, but there's no answer and it's probably too long for anybody to read.

    -
A: 

Is there any exception traced in Output window? WPF usually complains there instead of just failing the program.

ray
Yes there is. "Cannot retrieve value using the binding and no valid fallback value exists; using default instead." The getter is never called that's why this is so strange. I suppose this is some timing problem, but I'm not sure and even if it is I've got no idea what to do.
kubal5003
A: 

The problem may be related to your use of IsAsync and some problem with the target property's handling of an invalid result. You might want to try getting rid of the IsAsync parameter or using a PriorityBinding to set a safer default to use while waiting for the async loading to complete.

John Bowen
Thanks for your answer. Unfortunately this doesn't solve the problem. IsAsync was just an evidence of me trying every combination of parameters that was possible.
kubal5003