In my navigation-based Silverlight application I need to be able to set the title of the page. Unfortunately, if I attempt to set it in OnNavigatedTo, it appears to be too late.
Where can I set it within the page class so that I can set it in time?
Secondly there's the scenario where you've using the.net RIA services where you have to wait until the service returns back the information that you need, how do we get the page title set correctly in that situation?
There are a couple of problems with the approach of using the Html document, firstly it won't get set in the history unless it is done in time, which is the same problem of setting Page.Title directly Secondly, as I understand itm these properties are not
available in the off-line mode.
Really the key issue is how do I set the title consistently early enough to be able to be used in the history. The current design doesn't seem to even recognize that is important.
We have fixed this bug post-Beta, so at RTW setting the Title at any time will update the browser's title.
This has one caveat - if you hit the dropdown arrow next to the back button in Firefox (and I think in Chrome or Safari as well, I don't recall right now) you'll see titles get out of sync in there if you hit back/forward. This is similar to what AJAX experiences
(try it in GMail, you'll see it there too). But we felt this oddity was acceptable given that users see these titles much less often than the main browser window itself.
StefanOlson
Member
260 Points
139 Posts
How do I set the page title?
May 30, 2009 05:23 AM | LINK
In my navigation-based Silverlight application I need to be able to set the title of the page. Unfortunately, if I attempt to set it in OnNavigatedTo, it appears to be too late.
Where can I set it within the page class so that I can set it in time?
Secondly there's the scenario where you've using the.net RIA services where you have to wait until the service returns back the information that you need, how do we get the page title set correctly in that situation?
...Stefan
SharpGIS
Contributor
4825 Points
832 Posts
Re: How do I set the page title?
Jun 01, 2009 03:55 AM | LINK
HtmlPage.Document.SetProperty("title", "My page title");
/Morten | Silverlight MVP | blog - twitter
Please click on "Mark as Answer" if this answered your question.
StefanOlson
Member
260 Points
139 Posts
Re: How do I set the page title?
Jun 03, 2009 05:25 AM | LINK
There are a couple of problems with the approach of using the Html document, firstly it won't get set in the history unless it is done in time, which is the same problem of setting Page.Title directly Secondly, as I understand itm these properties are not available in the off-line mode.
Really the key issue is how do I set the title consistently early enough to be able to be used in the history. The current design doesn't seem to even recognize that is important.
...Stefan
SharpGIS
Contributor
4825 Points
832 Posts
Re: Re: How do I set the page title?
Jun 03, 2009 06:27 AM | LINK
/Morten | Silverlight MVP | blog - twitter
Please click on "Mark as Answer" if this answered your question.
AustinLamb
Member
602 Points
104 Posts
Microsoft
Re: Re: How do I set the page title?
Jun 04, 2009 09:51 PM | LINK
We have fixed this bug post-Beta, so at RTW setting the Title at any time will update the browser's title.
This has one caveat - if you hit the dropdown arrow next to the back button in Firefox (and I think in Chrome or Safari as well, I don't recall right now) you'll see titles get out of sync in there if you hit back/forward. This is similar to what AJAX experiences (try it in GMail, you'll see it there too). But we felt this oddity was acceptable given that users see these titles much less often than the main browser window itself.