开发者

Silverlight : Issue with Childwindow and navigation framework

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 i开发者_StackOverflowe 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 what Frame.JournalOwnership is set to.

JournalOwnership.Automatic (the default) - if the Frame 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 other Frame along the way.

JournalOwnership.OwnsJournal - the Frame will always own its own journal and not attempt to interact with the browser's journal.

JournalOwnership.UsesParentJournal - the Frame will always integrate with the browser. If it is not a top-level Frame 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 (because Popup is not rooted in the visual tree in the same way, and ChildWindow uses a Popup). 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜