Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am developing Xamarin forms project, I have added button on one of my Xaml page but I am not able to generate click event for this button but Visual studio is not showing any intellisense.

I have read in another post that suggest installing Resharper for this issue but it is not feasible for me because I do not have installation permission.

I am using Visual Studio Enterprise edition 2017.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
298 views
Welcome To Ask or Share your Answers For Others

1 Answer

Working with Intellisense

In VisualStudio ctrl+space to kick intellisense. Move your cursor right between the quotes, as seen in the image below, and hit ctrl+space. Intellisense should pop up now suggesting to create an event handler.

image of xaml-event

Manual Solution

In general you could use the Xamarin documentation to find out how the event handler method should look like.

public event EventHandler Clicked

The event uses .NETs EventHandler so it will get an object sender and an EventArgs args as parameter.

Xamarin Button Clicked EventHandler

//You may have to change the Name depending on how you name that handler in xaml

void OnButtonClicked(object sender, EventArgs args)
{

}

Update:

Of course you have to add

using System;

at the top of your file in order to use EventArgs.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...