DockPanel の左または右にドッキングできる StackPanel があります。StackPanel 内のアイテムは、祖先と同じように同じ側にドッキングする必要があります。テストのために、Visual Tree で先祖の名前を取得しますが、Docking.Dock にバインドする方法がわかりません。前もって感謝します。
<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>