How to show Silverlight Views in web page?
I have a silverlight project and a ASP.net Project in the solution. there are different views in my 开发者_如何学Pythonsilverlight project. If i want to show a particular view from that how can i do that. Every time its default to MainPage.xaml.
Silverlight uses URL bookmarks to make it's navigation systems work.
In Visual studio create a new Business Application Project and take a look at the way it maps hyperlink bookmark URLs to views.
You can then have similar URLs on your website to start the Silverlight application with a specific page showing.
Please note that Silverlight apps, like Flash, exist only for the life of the actual HTML page you are on. Bookmarks do not cause the current page (and therefore Silverlight Application) to reload, hence being used for Silverlight navigation.
In App.xaml.cs (in your Silverlight project), change this line to load your other xaml page:
private void Application_Startup(object sender, StartupEventArgs e)
{
this.RootVisual = new MainPage();
}
If you want to be able to select the page at runtime, you can use the InitParams to pass that information via the StartupEventArgs from your HTML page into your Silverlight control.
精彩评论