This project is read-only.

NavigationContainers and ChildWindows

Sep 3, 2010 at 9:00 AM

Hi,

I'm trying to use ChildWindow derived Controls to display or get Information to/from the user. I'd also like to jump into the application with an URL that displays a ChildWindow (e.g. an EMail confirmation completed dialog).

Unfortunately the standard navigation container just sets the the content of the container. If it is a child window it must call Show() on the child container instead of inserting it into the content control.

From my perspective I have several options:

  • derive from a standard navigation container (set as default navigation container) and override ProcessResponse (remove child window from content and call Show() ) ... problems: What is the URL when the child window is closed by the user? What is displayed in the content of the navigation control? Feels like a hack! :(
  • using a navigation container proxy as a default that routes the navigation requests to other navigation containers (based on user control, or custom to show the child window)
  • Using a special handler for ChildWindows URIs with a special Map-Attribute ... does this work with external URIs?

 

Can someone comment on these approaches? Are there other solutions?

 

Thank you

Falk

Sep 3, 2010 at 12:38 PM

Hi Falk, 

First thing you need to consider is that ChildWindows are special in that they are not part of the main VisualTree -  SL infrastructure has a special/internal provision to show it. Keeping that in mind, there are two parts to your problems, one is to show the ChildWindow, and the second is to navigate into it right?

For the first part, I normally tackle showing child windows using ViewServices, see my approach described here: http://www.orktane.com/Blog/post/2009/10/23/Web-Xcel-Demo-View-Services-in-nRoute.aspx

For the second part, all you need to actually do is implement INavigationHandler (which is quite simple) and that should be enough to get navigation content in. Now, the only issue I suppose would be that you need to have the INavigationHandler in place before it can handle the request/response, for that I suppose you can proxy though the same ViewService that handles creating/showing child windows. So it would create the child-window if it didn't exist, else it would pass on the request/response. I think that should work. Also using the NavigationService you can register an handler with a unique-name, so when you try and navigate you can just use a handler name without having to directly reference it.

Lastly, also just consider something called "Navigation Adapters", as show here (step 11): http://www.orktane.com/Blog/post/2010/06/30/Creating-a-Netflix-App-using-nRoute-A-Step-by-Step-Guide.aspx 
I'm not sure if they will work with child-windows, but if they can then that might make it even easier.

Hope this helps,
Rishi