Hello,
The official documentation provides best practices for setting up MVVM for individual pages. For your application scenario, there may be overlapping properties and methods between different ViewModels
since you are involved in data manipulation.
Therefore, you can build on the official documentation by first implementing a BaseViewModel
in which the properties and methods needed for multiple pages are implemented. After implementing the BaseViewModel
, you can then inherit the BaseViewModel
for different pages to implement their corresponding ViewModels
.
There are two main benefits of doing this:
- Consolidate redundant properties and save code.
- Since the common properties are contained in a class, it is also easy to maintain and modify them.
Best Regards,
Alec Liu.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.