Startup params for Silverlight 4 app
We are moving our SL3 app to SL4. First step was to open it in VS2010; it converted w/o problem.开发者_如何学Go
However, parameters specified for the start page are not passed along. That is, if we specifyourStartPage.aspx?Slam=Dunk&Glass=Sun
in app.xaml.cs, Application_Startup(), e.InitParams is empty.
How do we fix this? Thanks for any advice....
(Note that the very same startup string worked in VS2008.)UPDATE:
Urrk. This works, but it doesn't seem right: // Get settings passed in from the page
if (e.InitParams.Count > 0 )
{
ApplicationStartupContext.Instance.Fill(e.InitParams);
}
else
{
ApplicationStartupContext.Instance.Fill(HtmlPage.Document.QueryString);
}
The reason it works is that you have your params in the QueryString and not as InitParams as you might think.
InitParams covers a tag in the Silverlight object in HTML
Actually this link is a better example how to :)
It looks like it should be supported: http://msdn.microsoft.com/en-us/library/system.windows.startupeventargs.initparams(VS.95).aspx
from that page:
Silverlight
Supported in: 4, 3
精彩评论