在这样的场景中:
<Grid>
...
<local:MyControl x:Name="MyCtl" Grid.Row="1"/>
<Popup PlacementTarget="{Binding ???}"/>
<Grid>
我需要将 PlacementTarget 绑定(bind)到名为 MyBtn 的按钮在 内我的Ctl。什么是最干净的方法?
最佳答案
<Popup PlacementTarget="{Binding ElementName=MyCtl}" />
关于wpf - 如何将 Popup(或 ContextMenu)的 PlacementTarget 绑定(bind)到 UserControl 中的元素?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2098579/