public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. //Button.AccessibilityIdentifier = "myButton"; btn.SetTitle(SayHello.Hello(), UIControlState.Normal); btn.TouchUpInside += delegate { var title = string.Format("{0} clicks!", count++); btn.SetTitle(title, UIControlState.Normal); }; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); // Get our button from the layout resource, // and attach an event to it Button button = FindViewById <Button> (Resource.Id.myButton); button.Text = SayHello.Hello(); button.Click += delegate { button.Text = string.Format("{0} clicks!", count++); }; }