码迷,mamicode.com
首页 > Windows程序 > 详细

Prism.Interactivity 之 PopupWindowAction 用法简记

时间:2015-10-27 01:37:00      阅读:358      评论:0      收藏:0      [点我收藏+]

标签:

  • PopupWindow通过InteractionRequestTrigger(EventTrigger的派生类)侦听目标对象(InteractionRequest<T>类型)的Raised事件Show出来;
        <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委托。

Prism.Interactivity 之 PopupWindowAction 用法简记

标签:

原文地址:http://www.cnblogs.com/alwaysforward/p/4912910.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!