我们正在开发一个浏览器外的Silverlight 4应用程序,并希望在应用程序加载后更改标题。
示例:
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
this.Loaded += new RoutedEventHandler(MainPage_Loaded);
}
public string UserName { get; set; }
public string VersionNumber { get; set; }
void MainPage_Loaded(object sender, RoutedEventArgs e)
{
string title = string.Format("MyApplication {0} {1} ", this.VersionNumber, this.UserName);
HtmlPage.Window.Eval(string.Format("document.title='{0}'", title));
}
}
我尝试了三件事:
答案 0 :(得分:2)
答案 1 :(得分:0)
尝试设置:
<param name="windowless" value="true"/>
<object id="SilverlightControlApp" data="data:application/x-silverlight-2," type="application/x-silverlight-2"
width="100%" height="100%">
<param name="source" value="ClientBin/MyTestApp.Client.xap" />
<param name="onError" value="onSilverlightError" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="4.0.50826.0" />
<param name="windowless" value="true"/>
<%-- <param name="minRuntimeVersion" value="3.0.40818.0" />--%>
<param name="autoUpgrade" value="true" />
<a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50826.0" style="text-decoration: none">
<img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight"
style="border-style: none" />
<%-- <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=3.0.40818.0" style="text-decoration: none">
<img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight"
style="border-style: none" />--%>
</a>
</object>