Search code examples
c#.netwpfxbap

Open new Page from an Xbap


Our application is an Xbap running in full trust. I have a function similar to this:

private void ShowPage(Page page)
{
    NavigationWindow mainWindow = Application.Current.MainWindow as NavigationWindow;  
    mainWindow.Navigate(page);
}

This works great for browsing inside an existing window. I would like to open this new page in a separate window. Is there anyway to do this?

There is an overload that takes 'extraData' but I haven't been able to determine what to pass to navigate to a new window.


Solution

  • Apparently WPF is a little new for StackOverflow. Here is the function I came up with in case anyone else stumbles across this.

    private void ShowPage(Page page)
    {
        NavigationWindow popup = new NavigationWindow();  
        popup.Height = 400;
        popup.Width = 600;
        popup.Show();
        popup.Navigate(page);
    }
    

    I have not tried this in partial trust, it is likely this only works in full trust.