This repository was archived by the owner on Aug 27, 2020. It is now read-only.
This repository was archived by the owner on Aug 27, 2020. It is now read-only.
Proper way to Dispose ViewModel #22
Open
Description
@markjulmar : Could you please help me on below issue.
In my app I am using DependencyServiceExtension in the library to create my ViewModel. For example
BindingContext="{infrastructure:DependencyService Type={x:Type viewModels:HomeViewModel},
Scope=NewInstance}">
Due to some reason I don't want to keep the same instance of my view model through out the life time of the app. That is the reason I am using Scope as new Instance.
But now I noticed that the View Model that are created while navigation are not disposing at all. The events that I registered are firing for multiple times, based on the number of times I navigated to the page.
This is creating lot of issues in my application. Could you please let me know the best method to dispose this view models when the user navigates back (INavigationService.GoBack) method.
Metadata
Metadata
Assignees
Labels
No labels