PopupWindow通过InteractionRequestTrigger(EventTrigger的派生类)侦听目标对象(InteractionRequest
<winInteractivity:Interaction.Triggers>
<prism:InteractionRequestTrigger SourceObject="{Binding Path=EmployeePopupViewRequest,Mode=OneWay}">
<prism:PopupWindowAction IsModal="True" CenterOverAssociatedObject="True">
<prism:PopupWindowAction.WindowContent>
<views:EmployeeView />
</prism:PopupWindowAction.WindowContent>
</prism:PopupWindowAction>
</prism:InteractionRequestTrigger>
</winInteractivity:Interaction.Triggers>
PopupWindow实现IInteractionRequestAware接口,通过Action委托成员FinishInteraction关闭PopupWindow;
public Action FinishInteraction { get; set; }
public INotification Notification
{
get
{
return this.DataContext as INotification;
}
set
{
this.DataContext = value;
}
}
private void CloseWindow()
{
if (this.FinishInteraction != null)
this.FinishInteraction();
}
InteractionRequestedEventArgs(上述Raised事件的事件处理器的EventArgs)有两个主要成员,一个是INotification的派生类(将会作为PopupWindow的DataContext:即ViewModel),另一个是回调使用的Action委托。
手机扫一扫
移动阅读更方便
你可能感兴趣的文章