Skip to content
This repository has been archived by the owner on Sep 11, 2023. It is now read-only.

System.Windows.Data error 4: cannot find source for binding with reference #104

Open
maxijabase opened this issue Dec 1, 2021 · 0 comments
Assignees
Labels
source code This issue is about the editor's source code

Comments

@maxijabase
Copy link
Member

This spammy error in the VS Immediate Window happens when the program closes the ISAC window and executes the InterruptLoadAutoCompletes function located in EditorElementIntellisenseController.cs, more specifically, when both the AutoCompleteBox and MethodAutoCompleteBox's ItemSources get refreshed.

I managed to pull this little comment from one of MahApps Metro's documentation files:

<member name="M:MahApps.Metro.Controls.TabControlHelper.ClearStyle(System.Windows.Controls.TabItem)">
	 Sets the Style and Template property to null.
	 
	 Removing a TabItem in code behind can produce such nasty output
	 System.Windows.Data Warning: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.TabControl', AncestorLevel='1''. BindingExpression:Path=Background; DataItem=null; target element is 'TabItem' (Name=''); target property is 'Background' (type 'Brush')
	 or
	 System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.TabControl', AncestorLevel='1''. BindingExpression:Path=(0); DataItem=null; target element is 'TabItem' (Name=''); target property is 'UnderlineBrush' (type 'Brush')
	
	 This is a timing problem in WPF of the binding mechanism itself.
	
	 To avoid this, we can set the Style and Template to null.
</member>
@maxijabase maxijabase self-assigned this Dec 1, 2021
@maxijabase maxijabase added the source code This issue is about the editor's source code label Dec 1, 2021
maxijabase added a commit that referenced this issue Dec 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
source code This issue is about the editor's source code
Projects
None yet
Development

No branches or pull requests

1 participant