Summary
We’ve made quite a bit of progress with the application in this chapter. While it’s not yet connected to a live data source, we have methods in place to add and remove items from the media collection in memory. In addition, the project has been refactored to use the MVVM pattern, moving all the existing view logic from the MainWindow
code-behind file to a new MainViewModel
class. The new MainViewModel
class has no dependencies on the UI. Finally, we saw how integrating the MVVM Toolkit into the project can reduce the boilerplate code in our view models. These good software design habits will serve us well in the chapters ahead as we build more functionality onto the project.
In the next chapter, we will continue learning how to use the MVVM pattern to write robust, maintainable WinUI applications. We will cover some more advanced MVVM topics and learn some techniques for window management in a WinUI project.