Hi,
Where should we put button click events ? I was doing it inside the OnAppearing method of a ContentPage which is root page in my NavigationPage. On Button click I was navigating to another page
`protected override void OnAppearing ()
{
base.OnAppearing ();
Debug.WriteLine ("Inside page one");
var page = new PageTwo ();
btnClickMe.Clicked += async (sender, e) => {
await Navigation.PushAsync (page);
};
}`
but When I click back from second page, it works perfectly for first time. On second on click of button it pushes two pages and I've to press back for twice to navigate first page and this goes on for next clicks. But when I put the same click listener code in the constructor it was working fine.
So, is it a good practice to call all button click listeners in the constructor ? can we treat these constructors as onCreate methods of android activity ?
Thanks,
Chaitanya