There are two pages in my silverlight project: MainPage-default page and SecondViewPage an added Silverlight page. To navigate from one to ano开发者_开发知识库ther, I've overridden the Application_Startup(...)
{
this.RootVisual = mainUI;
mainUI.Children.Add(new MainPage());
}
created a
public static void GotoPage(UserControl nextPage)
{
App app = (App)Application.Current;
app.mainUI.Children.Clear();
//show next page
app.mainUI.Children.Add(nextPage);
}
Then openning the SecondViewPage is simple like:
App.GotoPage(new SecondViewPage());
But what I realy want is to open the second view page in a separage browser window because the removing childer and adding new makes navigation totally outside of the browser (the "back" button is not keeping the prvious page link).
Thanks for suggestions. V
This is exactly the sort of problem that the navigation framework is designed to solve.
I recommend you clear half an hour and watch this Silverlight TV Video on Channel 9.
Edit
If you must launch a separate window you the navigation framework would still be useful however you would use a standard window navigation. Like this:-
HtmlPage.Window.Navigate(new Uri("ThisHostPage.aspx#SecondView" UriKind.Relative), "_blank");
You seem to not be using any navigation features provided by Silverlight 4.
I recommend you try generating a test project using the "Business Application" template and see how multipage navigation can work. It has full support for browser back and forward and will save you a lot of work.
精彩评论