title: MVVMCross Calling function from the ViewModel to the View Xamarin
body: <p>I want to show a popup when someone click on a button, the button is in a listview which is load from a webservice, how can I send a message to the view to call the AlertDialog function ?</p>
  
  <p>I was maybe not very clear I paste my code bellow to see what I tried :</p>
  
  <p>In my viewmodel :</p>
  
  <pre><code>public void editPost(Post item)
  {
      PostToEdit = item;
  
      // Call the popup function
  }
  </code></pre>
  
  <p>In my view :</p>
  
  <pre><code>public Dialog showEditPopup()
  {
      var customView = LayoutInflater.Inflate(Resource.Layout.EditDialog, null);
  
      var builder = new AlertDialog.Builder(this);
      builder.SetView(customView);
      builder.SetPositiveButton("Save", SaveClicked);
      builder.SetNegativeButton("Cancel", CancelClicked);
  
      return builder.Create();  
  }
  </code></pre>
  
  <p>I tried to create an onclick function to initialize my AlertDialog in the View </p>
  
  <pre><code>var editButton = FindViewById&lt;Button&gt;(Resource.Id.editButton);
  editButton.Click += delegate { ShowDialog(EditDialog); }; 
  </code></pre>
  
  <p>But the application crash because the posts aren't load at the time of the oncreate so the editButton is null and the event click cannot be set, so I want to create the popup in the viewmodel.</p>