Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Is there anything new about the databinding error, "Cannot find source for binding with reference 'RelativeSource FindAncestor"?

$
0
0

I've been spending my time getting rid of those databinding errors that show up in Visual Studio's Output window. But there's one error which I don't think I can get rid of. Here's that error, reporting on 3 different controls:

System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.ListBox', AncestorLevel='1''. BindingExpression:Path=ActualWidth; DataItem=null; target element is 'CoreButtonList' (Name='QueryButtonList'); target property is 'Width' (type 'Double')
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.ListBox', AncestorLevel='1''. BindingExpression:Path=ActualHeigth; DataItem=null; target element is 'CoreButtonList' (Name='QueryButtonList'); target property is 'Height' (type 'Double')
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.ListBox', AncestorLevel='1''. BindingExpression:Path=ActualWidth; DataItem=null; target element is 'CoreButtonList' (Name='ReportList'); target property is 'Width' (type 'Double')

I've tried looking up this error and the resolutions people have come up with, but it isn't too promising. Here's 3 examples that I found:

http://www.codeproject.com/Tips/124556/How-to-suppress-the-System-Windows-Data-Error-warn?msg=4943524#xx4943524xx

http://stackoverflow.com/questions/14419248/cannot-find-source-for-binding

https://weblogs.asp.net/akjoshi/resolving-un-harmful-binding-errors-in-wpf

At least once in each of these posts someone talks about putting some code into the constructor, I presume of the view class, to suppress theseSystem.Windows.Data Error 4 messages. I also noticed that all of these are somewhat older; the most recent being from 2011. I'm wondering, has anything improved since then? Are there better ways of handling those errors or should we just put in that code to suppress System.Windows.Data Error 4?


Rod


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>