InteractionRequest 来实现弹窗交互,它是一个泛型接口,不同的类型对应不同类型的弹窗方式。
在使用InteractionRequest
的时候需要在,xaml中需要注册一个Trigger:
<i:Interaction.Triggers>
<prism:InteractionRequestTrigger SourceObject="{Binding NotificationRequest}">
<prism:PopupWindowAction IsModal="True" CenterOverAssociatedObject="True" />
</prism:InteractionRequestTrigger>
</i:Interaction.Triggers>
这里用到了Interaction
,他是i
命名空间里的东西,那么i
是什么呢?interactivity
这个是微软内置的类库,他提供了一组用户交互的类,比如我们这里用到的EventTrigger
可以用来执行事件触发的操作。
在使用的时候,先引入xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
或者xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
,然后在xaml中使用他:
<i:Interaction.Triggers>
<i:EventTrigger>
</i:EventTrigger>
</i:Interaction.Triggers>
public InteractionRequest<INotification> NotificationRequest { get; set; }
NotificationRequest.Raise(new Notification { Content = "Notification Message", Title = "Notification" }, r => Title = "Notified");
http://www.mamicode.com/info-detail-2323110.html
IEventAggregator eventAggregator show窗口
EventAggregator原理
1、消息订阅者向EventAggregator订阅消息
2、消息发布者向EventAggregator发布消息
3、EventAggregator想所有订阅该消息的订阅者发送
4、订阅者接受到消息,进行相关的逻辑处理
EventAggregator可以保证ViewModel相互独立的情况下,实现ViewModel之间的交互
https://blog.csdn.net/weixin_33716941/article/details/85994182
同步 异步
https://blog.csdn.net/coderK2014/article/details/81012004