Is there a way to reload the browser page from within Silverlight? i.e. have the same effect as a user clicking the reload button?
Asked
Active
Viewed 1.5k times
9
-
I prefer adding parameter to url query: http://stackoverflow.com/questions/1722615/forcing-browsers-to-reload-silverlight-xap-after-an-update – Rover Aug 06 '12 at 13:55
6 Answers
14
I've always used:
namespace for refresh page :
using System.Windows.Browser;
code: give this code inside ur button click..
HtmlPage.Document.Submit();

Community
- 1
- 1

Dan Auclair
- 3,607
- 25
- 32
-
Didn't work for me... :( Silverlight 4.0 on Windows7 x64 on either IE9 or Chrome 24 – m1m1k Jan 19 '13 at 01:57
7
You could try this::-
HtmlPage.Window.Navigate(HtmlPage.Document.DocumentUri);

AnthonyWJones
- 187,081
- 35
- 232
- 306
-
@Travis: That might be related to caching so modifying the cache headers sent by the server might help. – AnthonyWJones May 06 '11 at 19:42
3
Yes. You can use the NavigationService.Refresh method to reload the page.

Rune Grimstad
- 35,612
- 10
- 61
- 76
-
Does this really reload the browser page? Doesn't sound like it does from the documented link. – AnthonyWJones Apr 30 '10 at 13:02
2
http://www.divelements.com/silverlight/tools.aspx
Refer to the link above.
Use:
htmlHost.Document.Submit();

musefan
- 47,875
- 21
- 135
- 185

Sean Campbell
- 21
- 1
0
In the html or aspx page hosting your silverlight xap file write this function in javascript
function refreshPage() {
window.location.href = window.location.href + "?updated";
}
From inside your silverlight app, write the below piece of code to refresh the app without giving the user and impression that the page refreshed (considering the xap file is cached and it refreshes right away)
HtmlPage.Window.Invoke("refreshPage");

Taha Rehman Siddiqui
- 2,441
- 5
- 32
- 58