views:

28

answers:

0

I'm developing a WPF application where I have to navigate between different pages hosted in a Frame. I need also to keep alive the content of a page once created. In that way I can restore that content when I navigate again to it. I use the following handler to manage navigation:

private object content = null;

private void NavigateHandler(object sender, RoutedEventArgs e)
{
 // ... setting nextUri local variable ...

 if (content != null)
 {
  MyFrame.NavigationService.Navigate(content);
 }
 else
 {
  MyFrame.NavigationService.Navigate(nextUri);
 }
 content = MyFrame.NavigationService.Content;
}

It works fine, but if a page contains a WindowsFormHost I cannot see it when I navigate again to that page. Could someone help me to solve this problem? Thank you very much.