2012-02-28 62 views
0

我们将使用Silverlight 5作为浏览器外应用程序,并且需要具有主窗口的单独标题。在Silverlight 4中,据我所知,无法设置此属性(请参阅this问题)。默认情况下,主窗口具有项目的标题,后跟“应用程序”。 Silverlight 5是否能够改变主窗口标题?甚至在运行时通过数据绑定?在Silverlight 5中编辑MainPage标题

+0

似乎可以在“OutOfBrowserSettings.xml”中调整主窗口标题。但如何通过数据绑定在运行时更改它? – Dudemeister 2012-02-29 08:51:18

+0

看看下面的链接 [http://stackoverflow.com/questions/11445505/is-it-possible-to-change-the-title-of-the-application-in-out-of-browser-mode -in] [1] [1]:http://stackoverflow.com/questions/11445505/is-it-possible-to-change-the-title-of-the-application-in- out-of-browser-mode-in – Chitta 2012-07-17 12:19:46

+0

[http://stackoverflow.com/questions/11445505/is-it-possible-to-change-the-title-of-the-application-in-out-of-browser -mode式] [1] [1]:http://stackoverflow.com/questions/11445505/is-it-possible-to-change-the-tit le-of-the-the-the-application-in-out-of-mode-mode- – Chitta 2012-07-17 12:21:24

回答

0

在你的silverlight项目 - >属性 - > OutOfBrowserSettings.xml你可以更新标题。

请在下面找到我的示例设置页面。

<OutOfBrowserSettings ShortName="My OOB Application" EnableGPUAcceleration="False" ShowInstallMenuItem="True"> 
    <OutOfBrowserSettings.Blurb>This is my first OOB Application in SL 5.0</OutOfBrowserSettings.Blurb> 
    <OutOfBrowserSettings.WindowSettings> 
    <WindowSettings Title="My OOB Application" /> 
    </OutOfBrowserSettings.WindowSettings> 
    <OutOfBrowserSettings.SecuritySettings> 
    <SecuritySettings ElevatedPermissions="Required" /> 
    </OutOfBrowserSettings.SecuritySettings> 
    <OutOfBrowserSettings.Icons> 
    <Icon Size="16,16">Images/XX-16x16px.png</Icon> 
    <Icon Size="32,32">Images/XX-32x32px.png</Icon> 
    <Icon Size="48,48">Images/XX-48x48px.png</Icon> 
    <Icon Size="128,128">Images/XX-128x128px.png</Icon> 
    </OutOfBrowserSettings.Icons> 
</OutOfBrowserSettings> 

这里,WindowSettings - >标题会给主窗口标题& SHORTNAME将在快捷键给应用程序的名称。

感谢&问候, 卢梭Arulsamy

+0

Thx Rousseau。但是这并不新鲜,因为我已经在第一篇文章的评论中发布了。主要问题是如何在运行时通过数据绑定来更改它,因为我们使用MVVM模式,并且需要非常松散的耦合。 – Dudemeister 2012-03-07 07:22:54

0

主窗口的应用程序的标题可以在运行时只能通过“Application.Current.MainWindow.Title”进行调整。这不符合MVVM方法,因为您无法绑定到主窗口的title属性。这只适用于子窗口,因为您可以自己在代码中创建这些代码并完全控制它们。主窗口由系统提供,并在应用程序启动过程中创建。所以你不能在运行时绑定到属性。在初始化过程中,主窗口用“OutOfBrowserSettings.xml”中的参数设置正如我所说的,只能通过Application.Current.MainWindow“直接”调整主窗口参数...