Caching Views

When you navigate away from a view, by default, all references to the view are removed, and the view will be cleaned up the next time the garbage collector runs. However, this is not ideal if you need to retain the state of the view, such as when the user has entered unsaved data and is navigating away temporarily, or the view has been populated with data that would need to be retrieved again and repopulated.

You can, however, change this default behavior to cache the view and maintain its state by setting the NavigationCacheMode property on the view appropriately. NavigationCacheMode is a property of the Page class, which you can set in XAML. There are three options:

  • Disabled: This will result in the view being destroyed once ...

Get Pro Business Applications with Silverlight 5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.