ViewModel lifetime

ViewModel lifetime

Old forum URL: forums.lhotka.net/forums/t/10696.aspx


cconte posted on Monday, September 19, 2011

Hi folks,

We're developing a business  WPF application  using  CSLA4 and Bxf . We have just encountered an issue to manage the ViewModel lifetime. Cause, we didn't anticipate the ViewModel keep persisting through the pages.

Per exemple, one viewmodel has a timer, to get data data periodically. And this viewmodel continues to get data even when the relevant page is not being viewed because the viewmodel does not get destroyed when the user goes to a different page. (Maybe the timer should be in the page rather than the viewmodel?)

Can ViewModels be destroyed when the user navigates away from the associated page that is using them?

Is there an option with bxf to do this ?

Thanks in advance for your help,

Cédric

RockfordLhotka replied on Monday, September 19, 2011

I answered this in the Bxf forum on CodePlex.

cconte replied on Tuesday, September 20, 2011

Thanks Rocky. It was helpful for our WM lifetime understanding..

Below the link to Rocky answer.

http://bxf.codeplex.com/discussions/273108#post674015

Copyright (c) Marimer LLC