Skip to content
This repository has been archived by the owner on May 7, 2022. It is now read-only.

IsActive (Window) binding issue #44

Open
darul75 opened this issue Nov 16, 2017 · 3 comments
Open

IsActive (Window) binding issue #44

darul75 opened this issue Nov 16, 2017 · 3 comments

Comments

@darul75
Copy link

darul75 commented Nov 16, 2017

Please can you give a solution to solve all these bindings issues there...one per tree node diplayed.

Not sure to understand why it is related to a window and why in my context it does not work, but can I get rid of it?

Thx

System.Windows.Data Warning: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Window', AncestorLevel='1''. BindingExpression:Path=IsActive; DataItem=null; target element is 'MultiSelectTreeViewItem' (Name=''); target property is 'NoTarget' (type 'Object')
System.Windows.Data Warning: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Window', AncestorLevel='1''. BindingExpression:Path=IsActive; DataItem=null; target element is 'MultiSelectTreeViewItem' (Name=''); target property is 'NoTarget' (type 'Object')
System.Windows.Data Warning: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Window', AncestorLevel='1''. BindingExpression:Path=IsActive; DataItem=null; target element is 'MultiSelectTreeViewItem' (Name=''); target property is 'NoTarget' (type 'Object')
System.Windows.Data Warning: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Window', AncestorLevel='1''. BindingExpression:Path=IsActive; DataItem=null; target element is 'MultiSelectTreeViewItem' (Name=''); target property is 'NoTarget' (type 'Object')
.....

thousand of lines like that sometimes and tree rendering very slow at the end

@xyrus02
Copy link

xyrus02 commented May 10, 2018

Your problem seems to be that the root element of your visual tree is not inheriting from System.Windows.Window.
The four default templates contain a behavior which dims the selection brushes if the window which contains the control is inactive. In your case, the binding fails to obtain the window instance.

@ygoe
Copy link
Owner

ygoe commented May 10, 2018

@xyrus02 Isn't a focused control in an inactive window still "focused"? This is an issue with a lot of UI controls that just don't regard the top-level window state like good old Win32 controls did.

@xyrus02
Copy link

xyrus02 commented May 10, 2018

Yes indeed, you are right. In the visual tree, it is still marked as focused. I still would rather rely on that than on a property of a window because in theory, you can't always be sure that the top level element is a window (what about a page?)
Nonetheless, there shouldn't be a binding exception spamming OPs trace.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants