如何将我当前所在的窗口作为参数传递给命令?
我喜欢在 XAML 标记中这样做:
<Button Command="CommandGetsCalled" CommandParameter="-this?-" />
最佳答案
在我的情况下,提供的答案都没有奏效。
这对我有用:
<window x:Name="myWindow">
<Button Command="Command" CommandParameter={x:Reference Name=myWindow}/>
</window>
关于wpf - 将当前窗口作为 CommandParameter 传递,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3504332/