AndroidSupportComponents
AndroidSupportComponents copied to clipboard
Make it so that AlertDialog.Builder.SetOnCancelListener accepts a delegate/lambda
Android.Support.V7.App.AlertDialog.Builder
has 4 interesting methods: SetPositiveButton(string, EventHandler<DialogClickEventArgs>)
, SetNeutralButton(string, EventHandler<DialogClickEventArgs>)
, SetNegativeButton(string, EventHandler<DialogClickEventArgs>)
and SetOnCancelListener(IDialogInterfaceOnCancelListener)
. While the first 3 make it easy for the developer to set an action for the user input (I can just say SetPositiveButton("Confirm", delegate { MyAction(); })
, the fourth one requires the developer to create a class that implements IDialogInterfaceOnCancelListener
and implement just this one method OnCancel(IDialogInterface)
. It would be very helpful if we could do with SetOnCancelListener
the same that we do with the others, that being just setting a delegate as the action, for example SetOnCancelListener(delegate { MyAction(); })
.