user877127
user877127

Reputation: 87

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 silverlight project. If i want to show a particular view from that how can i do that. Every time its default to MainPage.xaml.

Upvotes: 1

Views: 471

Answers (2)

iCollect.it Ltd
iCollect.it Ltd

Reputation: 93571

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.

Upvotes: 1

Philipp Schmid
Philipp Schmid

Reputation: 5828

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.

Upvotes: 0

Related Questions