【问题标题】:Wpf Prism How to set WindowStartupLocation of Custom Popup WindowWpf Prism如何设置自定义弹出窗口的WindowStartupLocation
【发布时间】:2016-03-28 14:15:43
【问题描述】:

我已经通过使用 Prism 交互功能和 guide 成功实现了自定义弹出窗口。

<i:Interaction.Triggers>
    <prism:InteractionRequestTrigger SourceObject="{Binding CustomPopupViewRequest, Mode=OneWay}">
        <prism:PopupWindowAction>
            <prism:PopupWindowAction.WindowContent>
                <local:PurchasePaymentInfoView />
            </prism:PopupWindowAction.WindowContent>
        </prism:PopupWindowAction>
    </prism:InteractionRequestTrigger>
</i:Interaction.Triggers>

但弹出窗口显示在屏幕上的随机位置。我想将这个弹出窗口的WindowStartupLocation 定义为CenterScreen

【问题讨论】:

    标签: c# wpf prism


    【解决方案1】:

    如果您使用的是最新的预发布版本,则可以使用 WindowStartupLocation 属性。

    https://github.com/PrismLibrary/Prism/blob/master/Source/Wpf/Prism.Wpf/Interactivity/PopupWindowAction.cs#L50

    如果您不是,并且使用当前的CenterOverAssociatedObject 属性将无法满足您的需求:

    https://github.com/PrismLibrary/Prism/blob/master/Source/Wpf/Prism.Wpf/Interactivity/PopupWindowAction.cs#L40

    然后你必须创建自己的PopupWindowAction

    【讨论】:

    • 那我就等Prism下个版本了。
    • 我认为您想更新您的链接,因为代码已更改。特别是第二个。
    • 另外放一些解释例子也不错&lt;prism:PopupWindowAction WindowStartupLocation="CenterOwner"&gt;
    • 第三个,我认为WindowsStartupLocation 属性现已发布,它通过了pre-released 阶段。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-06-10
    • 2023-03-27
    • 1970-01-01
    • 1970-01-01
    • 2021-08-29
    • 2013-01-15
    • 1970-01-01
    相关资源
    最近更新 更多