0

On My Application last page I have a button,I entered the click event - no errors or warnings - ,But whenever i click the button nothing happens. Although before my last page i used buttons ,and used the exact same method and they are working .here the code

Button button = new Button
        {
            Text = "Log the Click Time",
        };
        button.Clicked += OnButtonClicked;

        this.Padding = 
            new Thickness(5, Device.OnPlatform(20, 0, 0), 5, 0);

        // Assemble the page.
        this.Content = new StackLayout
        {
            Children = 
            {
                button,
                new ScrollView
                {
                    VerticalOptions = LayoutOptions.FillAndExpand,
                    Content = loggerLayout
                }
            }
            };
    }

    void OnButtonClicked(object sender, EventArgs args)
    {
        // Add Label to scrollable StackLayout.
        loggerLayout.Children.Add(new Label
            {
                Text = "Button clicked at " + DateTime.Now.ToString("T")
            });
    }
}

}

the button is on the last page but it does not detect the click event

What I have tried:

to google for a solution- it pointed that the buttons id might differ , have checked that and retyped the code out .Youtube , But does not get the results what i need .

Ashwini Bhat
  • 500
  • 1
  • 4
  • 17

0 Answers0