I have a StackPanel that can be docked to the Left or Right inside of a DockPanel. The items in the StackPanel should dock to the same side like the ancestor does. For Testing i get the Name of the ancestor in Visual Tree but i have no idea how to bind to Docking.Dock. Thanks in advance.
<DockPanel>
<StackPanel x:Name="RightHandContainer" DockPanel.Dock="Right">
<v:MyUsercontrol TextCaption="Hard-Coded Alignment Works" Alignment="Right" />
<v:MyUsercontrol TextCaption="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=StackPanel, AncestorLevel=1}, Path=Name}"
Alignment="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=StackPanel, AncestorLevel=1}, Path=Docking.Dock}" />
<!-- TextCaption is is a dependencyproperty of Type string, works fine ... my Text object automatically gets 'RightHandContainer' -->
<!-- Alignment is is a dependencyproperty of Type Dock, like Docking.Dock ... Binding will not work :( -->
</StackPanel>
</DockPanel>