-
Notifications
You must be signed in to change notification settings - Fork 337
Description
Hi,
I use the latest package from AvalonDock: Version 4.72.1 in a .NET Framework 4.8 app, in combination with Caliburn.Micro. In some cases I got always this binding error in my app, if I switch between some anchorable elements:
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.TabControl', AncestorLevel='1''. BindingExpression:Path=Items.Count; DataItem=null; target element is 'TabItem' (Name=''); target property is 'NoTarget' (type 'Object')
This line in the Theme.xaml seems to be the "root cause":
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type TabControl}}, Path=Items.Count}" Value="1">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
</Style.Triggers>Unfortunately I have no idea what triggers this in my code for some anchorable elements and for some not. Let's say I have a ribbon with 5 buttons and with each button I can "open" an anchorable element which is displayed in the left pane. But they are locked: only one can be displayed at the time and the user have to "close" the active anchorable element before the next can be opened. Three of this five elements trigger the error if they were actived the first time, the other two work fine.
I grabbed the source code, deleted the Style.Trigger, compile and the binding errors are gone. Thats a workaround, but with a "very bad smell". I would be happy if someone could point me to the real root cause - probably in my code.
Thanks for all the work with AvalonDock,
Mike