Search code examples
c#xamarinxamarin-studio

Generate a method via Xamarin Studio Shortcut


I was using Visual studio and once you double tap it, it generates the corresponding method for you automatically.

However, recently I have started using Mac operating system and Xamarin Studio and would like to know whether or not there is a same shortcut to generate same functionality.

myListView.ItemClick += mListView_Click;

The following method created automatically in Visual Studio when you double tapped. But I do not know in Xamarin Studio.

void mListView_Click(object sender, AdapterView.ItemClickEventArgs e)
{
  Console.WriteLine ("Hello");
}

Solution

  • Turn on source code analysis for this to be enabled (within the preferences section of Xamarin Studio):

    enter image description here

    Restart Xamarin Studio for this to take effect. You should now be able to auto-generate event handlers like in Visual Studio:

    enter image description here

    Alternatively, write out the method name in full, right click, select Fix then Create Method: enter image description here