WPF Prism 5.0交互弹出窗口 - 如何让它不显示在TaskBar中?

时间:2014-10-08 22:12:32

标签: wpf prism

如果你有Prism 5.0 - 它有一个示例解决方案 快速入门\交互\ InteractivityQuickstart

它显示了如何使用定义了视图的弹出式UserControl InteractivityQuickstart \视图\ InteractionRequestView.xaml:

<prism:InteractionRequestTrigger SourceObject="{Binding CustomPopupViewRequest, Mode=OneWay}">
<!-- This PopupWindowAction has a custom view defined. When this action is executed the view will be shown inside a new window -->
<!-- Take into account that the view is created only once and will be reused each time the action is executed -->
    <prism:PopupWindowAction IsModal="True" CenterOverAssociatedObject="True">
        <prism:PopupWindowAction.WindowContent>
            <views:CustomPopupView />
        </prism:PopupWindowAction.WindowContent>
    </prism:PopupWindowAction>
</prism:InteractionRequestTrigger>

除了弹出窗口显示自己的任务栏按钮外,一切正常。 它只能是UserControl而不是Window - 无法设置ShowInTaskBar =&#34; False&#34;。

任何人都可以提供帮助 - 如何让它不显示自己的任务栏按钮?

2 个答案:

答案 0 :(得分:3)

UserControl没有属性ShowInTaskBar。 只需将窗口的属性 ShowInTaskBar 设置为 False 就可以了,如下所示:

<prism:InteractionRequestTrigger SourceObject="{Binding CustomPopupViewRequest, Mode=OneWay}">
<!-- This PopupWindowAction has a custom view defined. When this action is executed the view will be shown inside a new window -->
<!-- Take into account that the view is created only once and will be reused each time the action is executed -->
    <prism:PopupWindowAction IsModal="True" CenterOverAssociatedObject="True">
        <prism:PopupWindowAction.WindowStyle>
          <Style TargetType="Window">
            <Setter Property="ShowInTaskbar" Value="False"/>
          </Style>
        </prism:PopupWindowAction.WindowStyle>

        <prism:PopupWindowAction.WindowContent>
            <views:CustomPopupView />
        </prism:PopupWindowAction.WindowContent>

    </prism:PopupWindowAction>
</prism:InteractionRequestTrigger>
最好的问候。

答案 1 :(得分:-1)

Prism popupwindow有一些限制,所以你无法控制它。 而不是你可以尝试使用

http://blogs.southworks.net/dcherubini/2012/05/24/popupwindowaction-using-custom-views-instead-of-windows-in-wpf-and-prism/

此解决方案的好处是 - 您可以使用自定义弹出窗口,而不仅仅是通知或确认弹出窗口。

此外 - 您可以将信息传递回调用“InteractionRequest”的类。