Anss
Anss

Reputation: 674

UWP App caching entire page along with data

I am working on a Windows 10 UWP application (MVVM, Caliburn) and have enabled caching to reduce load on memory,

this.NavigationCacheMode = Windows.UI.Xaml.Navigation.NavigationCacheMode.Enabled;

The problem with this is that it is even caching the data that is plugging in from the ViewModel, for instance, a grid or bar chart is not reflecting the changes from the database and only showing the state they are cached in.

Any suggestions on how I can enable the caching and get refreshed data everytime a page opens?

Upvotes: 0

Views: 1464

Answers (2)

Marian Dolinský
Marian Dolinský

Reputation: 3492

You could use Bindings.Update(); to manually refresh the x:Bind expressions on the specific view and as Peter Torr said you should call it in the OnNavigatedTo method override.

Upvotes: 1

Peter Torr
Peter Torr

Reputation: 12019

Are you overriding the OnNavigatedTo method? This will get calles every time the page is navigated to, and you can refresh the data then.

Upvotes: 2

Related Questions