Reputation: 15608
I have a silverlight project that has many xaml pages. i have an external website that will call the silverlight website so e.g. http://mysilverlightproject:1230.com?queryString1=Page1.xaml.
i want to change the page by passing the values from query string.
is it possible to change the main xaml page to be another page from the query string?
Thanks
Upvotes: 1
Views: 4355
Reputation: 15608
string val = string.Empty;
if (HtmlPage.Document.QueryString.ContainsKey(”foo”))
{val = HtmlPage.Document.QueryString["foo"];}
Upvotes: 3
Reputation: 12093
you can pass pageId to SL application by initparams specific to different URLs and load required page inside SL application instead of default start page
Init params are placed in html and are passed inside SL app, like the following
<param name="InitParameters" value="queryString=Page10" />
Inside you can use SilverlightHost
class to get them
SilverlightHost host = new SilverlightHost();
if (host.InitParams.Count > 0)
{
foreach (var c in host.InitParams)
{
if(c.Key == "queryString")
RedirectToUIPage(c.Value) // your method
}
}
Upvotes: 0
Reputation: 3593
As far as I know you can't change Main page after it is assigned from App class. But you can use Navigation framework and navigate to needed page. In this case you also will be able to use browsers back/forward button.
This post is about navigating from code behind.
Upvotes: 1
Reputation: 1993
Take a look at how a Silverlight Navigation Application works. It will give you the functionality you request.
Upvotes: 0