Disposing View Models - WPF MVVM NAVIGATION TUTORIAL #6

Опубликовано: 04 Октябрь 2024
на канале: SingletonSean
10,741
179

Learn how and why to dispose view models in a WPF application. This is crucial for preventing memory leaks from view models never getting garbage collected. I also explain why it is preferable to make view model lifetimes transient rather than singleton.

Navigation is an essential piece of an application. In this series, I demonstrate how to implement various navigation scenarios in a WPF MVVM application.

TIMESTAMPS:
0:00 - Introduction
0:22 - Setting Up Disposal Scenario
3:25 - Memory Leak Investigation
4:17 - Implementing Dispose
5:40 - Propagating Disposals
6:37 - Disposing the NavigationBarViewModel
8:18 - Making View Models Transient
11:04 - Conclusion

SOURCE CODE: https://github.com/SingletonSean/wpf-...

OTHER LINKS:
Become a Member:    / @singletonsean  
Donations: https://www.paypal.com/biz/fund?id=UB...