问题描述
我正在尝试使用类似于this的解决方案来关闭窗口,但是viewmodel中的处理程序是在应用程序启动时触发的,而不是在关闭时触发的。
XAML:
<i:Interaction.Triggers>
<i:EventTrigger EventName="Closing">
<command:EventToCommand Command="{Binding WindowClosing}" PassEventArgsToCommand="True" />
</i:EventTrigger>
</i:Interaction.Triggers>
viewmodel:
public RelayCommand<System.ComponentModel.CancelEventArgs> WindowClosing
{
get
{
return new RelayCommand<System.ComponentModel.CancelEventArgs>((args) => {});
}
}
绑定显然在起作用,但是它只是在错误的时间触发。我以为EventName =“ Closing”是应该绑定到实际关闭事件的内容,但是其中包含的内容并不重要。它总是在加载时触发。究竟该如何将其链接到实际的关闭窗口事件?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)