Quantcast
Viewing all articles
Browse latest Browse all 76418

Mvvm - Creating Views/Viewmodels Used On Multiple Views

I'm wondering how best to structure components that are used in multiple views.

For example, the app I'm working on will have a button present on most views that opens the camera and allows the user to take a picture. The button command (TakePicture) is going to be the same for each view that this button is present in. Obviously I don't want to duplicate the command for each view with the button. When creating components like this, would you recommend creating a view model for this component specifically and then add the component to the parent page(s), or would it be better to have a base page and view model that contains the button, and have each page/view model inherit from that? Or is there a different approach that I haven't considered?

I have the same question regarding a toolbar-style menu on each page.

Thanks


Viewing all articles
Browse latest Browse all 76418

Trending Articles