I changed the silverlight project property file in to 开发者_如何学Goout of browser option. The screen is loaded with no controls. Any idea?
Yes. It is working fine the browser and when it is set to out of browser application, the application is installed in the start up as well as desktop. when we load it is opened with a blank screen and no control was loaded.
It could be related to unhandled exception happened inside App.xaml.cs during start-up. For instance, if you try to reach any in-browser-application only objects such as System.Windows.Browser.HtmlPage, you will get Null reference exception. You should be able to find this out by put a break point inside App.xaml.cs.
Here is an example that you can see in browser application but you will get a blank window in out of browser.
System.Windows.Browser.HtmlPage.Document.DocumentUri;
To support both in-browser and out-browser, you should do the following.
if (Application.Current.IsRunningOutOfBrowser)
{
// MessageBox.Show("Application.Current.Host.Source = " + Application.Current.Host.Source.ToString());
return Application.Current.Host.Source;
}
// MessageBox.Show("DocumentUri = " + System.Windows.Browser.HtmlPage.Document.DocumentUri.ToString());
return System.Windows.Browser.HtmlPage.Document.DocumentUri;
If this is not the case, please try to rebuild your solution by toggling "Enable the application out of the browser". Sometimes you have to build twice (the first one without the check, the second one with the check) before you can see the out-of-browser application window.
精彩评论