Dragablz
Dragablz copied to clipboard
Error if AncestorType is not Window
I get the following errors if I place the TabablzControl not in a Window but in a UserControl.
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Window', AncestorLevel='1''. BindingExpression:Path=Background; DataItem=null; target element is 'TabablzControl' (Name='ManualModeTabControl'); target property is 'Background' (type 'Brush')
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Window', AncestorLevel='1''. BindingExpression:Path=(0); DataItem=null; target element is 'TabablzControl' (Name='ManualModeTabControl'); target property is 'Foreground' (type 'Brush')
It seems that AncestorType='System.Windows.Window'
expects a window. Anyways it is working as expected but maybe this can have an effect in other use cases.
Hi sorry, havent got to it. Could you please post a working, isolated test repo?
I ended up setting the properties by hand to make the warnings go away...
Background="{Binding RelativeSource={RelativeSource AncestorType=UserControl}, Path=Background}" Foreground="{Binding RelativeSource={RelativeSource AncestorType=UserControl}, Path=Foreground}"