protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); Button button = FindViewById<Button>(Resource.Id.MyButton); _upSwitch = FindViewById<Switch>(Resource.Id.upToggleButton); _downSwitch = FindViewById<Switch>(Resource.Id.downToggleButton); _multipleSwitch = FindViewById<Switch>(Resource.Id.multipleToggleButton); button.Click += delegate { var dialog = new AlertDialog.Builder(this) .SetTitle("Delete entry") .SetMessage("Are you sure you want to delete this entry?") .Show(); dialog.SetOnKeyListener(this); }; }