Hello,
Welcome to Microsoft Q&A!
In Xamarin Android, FormsAppCompatActivity
already contain the ViewModelStore
method . It is the same effect with Native Android ViewModelStoreOwner
to get ViewModelStore
.
Here it the native ViewModelStoreOwner
class:
public interface ViewModelStoreOwner {
/**
* Returns owned {@link ViewModelStore}
*
* @return a {@code ViewModelStore}
*/
@NonNull
ViewModelStore getViewModelStore();
}
In Xamarin Android, you could write code as follows below FormsAppCompatActivity
class:
public override ViewModelStore ViewModelStore => base.ViewModelStore;
Then you also will get the ViewModelStore
.
Best Regards,
Junior Jiang
----------
If the response is helpful, please click "Accept Answer" and upvote it.
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.