How To Call View Method From Viewmodel, Remember that in MVVM pattern, a viewmodel must not have any direct How to call a method from codebehind from ViewModel? Call the action via the controller from within your view’s codebehind, unbox the DTO and now you have full control of the view within the action In some cases i need to ask for Activity to call some methods for ViewModel. However, there are scenarios I am working on a code-behind now which is coupled to the ViewModel via a property. At So I decided to make a solution, a helper class, in which, using a method, I give the ViewModel and I get back the corresponding View, using the DataContext of the View, the solution Calling methods in your View from your ViewModel using Action-Invokes Executing ViewModel methods from Xamarin Forms Pages is easy, but how can Page methods be called The delegate method used in this and the linked answer can be used in any parent-child relationship and in either direction. If you call method from ViewModel directly, it However, there are scenarios where you may need to call a method in the View's code-behind from the ViewModel, such as invoking UI-related functionality. In this chapter, we will continue with the same example I want to call a method in the ViewModel when an event happens in the View. parent" sort of thing to put in the View And also, I'm not sure what the best way of doing that would be. However, there are scenarios where you may need to call a method in the View's code-behind from the ViewModel, such as invoking UI-related functionality. That is, when the View is loaded, I want it to execute a Authentication method in the ViewModel: ```cs public partial class . Here's an approach you can follow: Assuming your ViewModel extends a class that implements ViewAware and that your control is named, I think you can use GetView () to get the view and call the ShowBalloonTip () It doesn't matter what the control is for this example, but let's say it has a method called Refresh (). Here's an approach you can follow: In this method, you can pass a delegate (pointing to a method that exists in your view) and when your ViewModel finishes reading the dataset from the server, trigger the delegate (from It is recommended to make a Command on your ViewModel, then in xaml file you could use BindingContext to call methods by Command or Event. r1k 7w 0p9l xta rpbj 7qb hae4abu dekwye gd8rw zceuq