This repository was archived by the owner on Sep 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
System.Windows.Data error 4: cannot find source for binding with reference #104
Copy link
Copy link
Open
Labels
source codeThis issue is about the editor's source codeThis issue is about the editor's source code
Description
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>
Metadata
Metadata
Assignees
Labels
source codeThis issue is about the editor's source codeThis issue is about the editor's source code