could someone help me with childwindow and Navigation?
I created a childwindow from code and set its content as
ChildWindow CW = new ChildWindow();
CW.Content = new MainPageMenu(param1);
Here "MainPageMenu" itself is a Silverlight Page with a "navigation:Frame"
In the constructor, i navigate to various pages according to "param1" .
As i navigate to the desired page , the ie address bar shows the updated uri.
Should it show that? as the page is navigated in a childwindow......?
This works fine for first time. Once i close the childwindow and reopen with diff "param1" to navigate to other page
it never gets navigated..!!! it shows the same page as navigated to for the first call...
there is no error at line -
this.ContentFrame.Navigate(u);
in the constructor.
Is this a bug in navigation framework or i am supposed to something else to achieve this ?
Please help.
I see you already figured out that
JournalOwnership
is th key here. But just for a bit more background so this is less magic and more algorithm, here's how the Navigation Framework figures out whether to integrate with the browser journal, based on whatFrame.JournalOwnership
is set to.JournalOwnership.Automatic
(the default) - if theFrame
is a "top level"Frame
, it will navigate with the browser journal. If it's not, it won't. "Top level" means that if it walks up the visual tree it does not find any otherFrame
along the way.JournalOwnership.OwnsJournal
- theFrame
will always own its own journal and not attempt to interact with the browser's journal.JournalOwnership.UsesParentJournal
- theFrame
will always integrate with the browser. If it is not a top-levelFrame
this causes an Exception to be thrown.So what's interesting about ChildWindow is that when
Frame
walks up the visual tree to see if it's a "top-level"Frame
, it won't find one (becausePopup
is not rooted in the visual tree in the same way, andChildWindow
uses aPopup
). Hence, it will think it's top-level (which may not really be correct in this case, but what else could it do?) so it will integrate with the browser journal.