I have started seeing an unusual issue with some of the binding on my textblocks:
XAML
<TextBlock Text="{Binding PartCount,FallbackValue=1, UpdateSourceTrigger=PropertyChanged, diag:PresentationTraceSources.TraceLevel=High}" Foreground="Black" Margin="-3"/>
I know for sure that my binding path resolution is correct because if I change this block to a label with content instead of text then it works just fine.
I have the diagnostic logger enabled for the binding and I can see it initialise correctly and set the initial value from its source:
DEBUG LOG
System.Windows.Data Warning: 67 : BindingExpression (hash=40999308): Resolving source (last chance) System.Windows.Data Warning: 70 : BindingExpression (hash=40999308): Found data context element: TextBlock (hash=5477191) (OK) System.Windows.Data Warning: 78 : BindingExpression (hash=40999308): Activate with root item LoadStack (hash=22395825) System.Windows.Data Warning: 107 : BindingExpression (hash=40999308): At level 0 using cached accessor for LoadStack.PartCount: RuntimePropertyInfo(PartCount) System.Windows.Data Warning: 104 : BindingExpression (hash=40999308): Replace item at level 0 with LoadStack (hash=22395825), using accessor RuntimePropertyInfo(PartCount) System.Windows.Data Warning: 101 : BindingExpression (hash=40999308): GetValue at level 0 from LoadStack (hash=22395825) using RuntimePropertyInfo(PartCount): 'Infinity' System.Windows.Data Warning: 80 : BindingExpression (hash=40999308): TransferValue - got raw value 'Infinity' System.Windows.Data Warning: 84 : BindingExpression (hash=40999308): TransferValue - implicit converter produced '∞' System.Windows.Data Warning: 89 : BindingExpression (hash=40999308): TransferValue - using final value '∞'
But then, when I navigate to the window that shows this text box I get this:
DEBUG LOG
System.Windows.Data Warning: 79 : BindingExpression (hash=40999308): Deactivate System.Windows.Data Warning: 103 : BindingExpression (hash=40999308): Replace item at level 0 with {NullDataItem} System.Windows.Data Warning: 63 : BindingExpression (hash=40999308): Detach
So after this point the visual element does not update, but I do still get information in the log when the source changes like so:
DEBUG LOG
System.Windows.Data Warning: 95 : BindingExpression (hash=53188122): Got PropertyChanged event from LoadStack (hash=22395825) System.Windows.Data Warning: 101 : BindingExpression (hash=53188122): GetValue at level 0 from LoadStack (hash=22395825) using RuntimePropertyInfo(PartCount): '50' System.Windows.Data Warning: 80 : BindingExpression (hash=53188122): TransferValue - got raw value '50' System.Windows.Data Warning: 84 : BindingExpression (hash=53188122): TransferValue - implicit converter produced '50' System.Windows.Data Warning: 89 : BindingExpression (hash=53188122): TransferValue - using final value '50'
So something is causing that "deactivate" & "detach" which means that it no longer updates the view. I have checked that the data context is consistent, which it is.
Is there anything that can cause the binding to respond in this way?