Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个用户控件,并在该用户控件中控制一个按钮。
单击该按钮时,我需要通过命令参数传递整个视图。
如何通过命令参数传递视图?
如果我记得正确的方法(并且您想绑定到当前的 Window 实例),它应该是
CommandParameter="{Binding RelativeSource={RelativeSource AncestorType={x:Type Window}}}"
请参阅:如何将 WPF 绑定与 RelativeSource 结合使用?