tags:

views:

1552

answers:

1

I've come across a strange scenario where a frame refuses to refresh its content.

I can kinda understand what's happening but the solution is not coming to me.

I have a page that has a frame (Frame1) and several buttons. When I click on a button a page is loaded into the frame. This works perfectly in most situations.

Private Sub btnIncidents_Click(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles btnIncidents.Click
    Frame1.Source = New System.Uri("/Incident/Incidents.xaml", UriKind.Relative)
End Sub

However, I have a situation where I need to select the button that was previously clicked to effectively do a Refresh on the Uri. The problem is it simply does nothing because the Uri hasn't changed. That makes sense but it's not what I want, I need to call it again.

My first solution was to introduce Frame1.Refresh which initially did the trick. But once a page was Refreshed, none of the Buttons could load a different page.

It was as if by calling Frame1.Refresh I'd broken the Frames ability to navigate to other pages.

My second idea was to set the Frame source to Nothing (Null) and then set the source to the URI but that didn't work either. ie Frame1.Source = Nothing

Has anyone else come across this or maybe have some suggestions? I just need to Refresh/Reload the Frames page without breaking the Frame!

+1  A: 

I had the similar problem - with html though. Resolved it with

frame.NavigationService.Refresh();

apparently will clear navigation history, but in my case I do not really care.

Got the answer from http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/8fc6bd83-2803-4820-a22b-d4d87638c4e2

Ope