在Silverlight 4中编辑标题 [英] Edit Title in Silverlight 4

查看:205
本文介绍了在Silverlight 4中编辑标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在开发一个浏览器外的Silverlight 4应用程序,并希望在应用程序加载后更改标题。



示例:

  public partial class MainPage:UserControl 
{
public MainPage()
{
InitializeComponent
this.Loaded + = new RoutedEventHandler(MainPage_Loaded);
}

public string UserName {get;组; }
public string VersionNumber {get;组; }

void MainPage_Loaded(object sender,RoutedEventArgs e)
{
string title = string.Format(MyApplication {0} {1},this.VersionNumber,this。用户名);

HtmlPage.Window.Eval(string.Format(document.title ='{0}',title));
}
}

strong>


  1. 上述示例不起作用,并抛出InvalidOperationExceptionDOM /脚本桥被禁用。我找到的所有参考资料,示例


  2. 创建自定义OOB窗口


  3. 调整OutOfBrowserSettings.xml文件,但它不会


有关如何调整标题的任何建议应用程序加载完成后

不幸的是,唯一的方法是创建一个自定义OOB窗口: out-of-browser-window-in-silverlight-4.aspxrel =nofollow>此处此处示例。


We are developing an out-of-browser Silverlight 4 application and want to change the title after the application loads.

Example:

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));
    }
}

Three things I have tried:

  1. The above example does not work and throws an InvalidOperationException "The DOM/scripting bridge is disabled." All the references I found, example, said the HTML bridge is disabled in OOB mode.

  2. Create a custom OOB Window, example, but I would prefer a more elegant solution.

  3. Adjust the OutOfBrowserSettings.xml file, but it doesn't appear that I can get access to it after Load.

Any ideas on how to adjust the title after the application has loaded?

解决方案

Unfortunately, the only way to do this is to create a custom OOB Window:

Look here and here for examples.

这篇关于在Silverlight 4中编辑标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆