WPF+PRISM How to make the popup window owner as main window
<p>I am having trouble setting the owner of Popup window to Application Main window.</p>

<p>Here what I did.</p>

<ol>
<li><p>Created a Main Window with custom PopupWindow.</p>

<pre><code>&lt;Window x:Class="MainWindow"
    ...

    &lt;Window.Resources&gt;
        &lt;Style x:Key="MessageWindowStyle" TargetType="{x:Type Window}"&gt;
            &lt;Setter Property="Background" Value="Transparent" /&gt;
            &lt;Setter Property="WindowStyle" Value="None" /&gt;
            &lt;Setter Property="ResizeMode" Value="NoResize" /&gt;
            &lt;Setter Property="BorderThickness" Value="1" /&gt;
            &lt;Setter Property="SnapsToDevicePixels" Value="True" /&gt;
            &lt;Setter Property="ShowInTaskbar" Value="False"/&gt;
            &lt;Setter Property="AllowsTransparency" Value="True"/&gt;
        &lt;/Style&gt;
    &lt;/Window.Resources&gt;

    &lt;i:Interaction.Triggers&gt;
        &lt;interactionRequest:InteractionRequestTrigger SourceObject="{Binding MessageRequest, Mode=OneWay}"&gt;
            &lt;interactionRequest:PopupWindowAction IsModal="True" CenterOverAssociatedObject="True" WindowStyle="{StaticResource MessageWindowStyle}" &gt;
                &lt;interactionRequest:PopupWindowAction.WindowContent&gt;
                    &lt;controls:PageCustomPopup /&gt;
                &lt;/interactionRequest:PopupWindowAction.WindowContent&gt;
            &lt;/interactionRequest:PopupWindowAction&gt;
        &lt;/interactionRequest:InteractionRequestTrigger&gt;
    &lt;/i:Interaction.Triggers&gt;

    ...
&lt;/Window&gt;
</code></pre></li>
<li><p>PageCustomPopup.xaml</p></li>
</ol>

<p>This is basic xaml for the popup window.</p>

<pre><code>    &lt;UserControl x:Class="PageCustomPopup"
        ...
    &lt;/UserControl&gt;
</code></pre>

<ol start="3">
<li>PageCustomPopup.xaml.cs</li>
</ol>

<p>In this page code-behind, I tried to set the parent, when the popup window is loaded. But it throws exception.</p>

<pre><code>    public partial class PageCustomPopup : UserControl,  InteractionRequestAware, INotifyPropertyChanged
    {
        public PageCustomPopup()
        {
            Loaded += (sender, args) =&gt;
            {
                try
                {
                    var parentWindow = this.Parent as Window;
                    if (parentWindow != null)
                    {
                        // This line fails with "Cannot set the Owner after the window is displayed."
                        //parentWindow.Owner = Application.Current.MainWindow;

                        // First, default to the main window's dimensions
                        parentWindow.Width = Application.Current.MainWindow.Width;
                        parentWindow.Height = Application.Current.MainWindow.Height;
                        parentWindow.Left = Application.Current.MainWindow.Left;
                        parentWindow.Top = Application.Current.MainWindow.Top;
                    }
                }
            }
        }
    }
</code></pre>

<ol start="4">
<li><p>MainWindow code behind.</p>

<pre><code>public InteractionRequest&lt;Notification&gt; MessageRequest { get; private set; }

public MainWindow()
{
    ...

    MessageRequest = new InteractionRequest&lt;Notification&gt;();

    ...
}

void Button_OnClick(object sender, EventArgs e)
{
    MessageRequest.Raise(new Notification(){ Title = "Title Text", Content = "Message to Display"});
}
</code></pre></li>
</ol>

<p>When the Custom popup window is displayed, it shows correctly in the center of the main window.</p>

<p>But the issue is, when all the windows are minimized, if the Application icon on the taskbar is clicked, the Application main window is displayed, and inavtive. Cannot select anything.</p>

<p>The popup window is hidden and cannot bring to front.</p>

<p>The only way to bring the Popup window in front, is using "Alt+Tab" keys.</p>

<p>My question is, how to set the Custom popup window owner to Application.Current.MainWindow?
So that, by selecting taskbar icon or Alt+Tab, displays both Mainwindow and popup window.</p>