Steve.NayLinAung
Steve.NayLinAung

Reputation: 5155

Wpf Prism How to set WindowStartupLocation of Custom Popup Window

I've successfully implemented Custom Popup Window by using Prism interactivity feature with this 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>

But the Popup Window is displayed at random position on the screen. I want to define WindowStartupLocation to CenterScreen of this Popup Window.

Upvotes: 1

Views: 1421

Answers (1)

user5420778
user5420778

Reputation:

If you are using the latest pre-release you can use the WindowStartupLocation property.

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

If you are not, and using the current CenterOverAssociatedObject property will not meet your needs:

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

Then you will have to create your own PopupWindowAction.

Upvotes: 2

Related Questions