c# - Invoke GetDeferral on ContentDialog's Custom Buttons -


i have contentdialog use object crud operations. use messagedialog during verification alarm user missing info etc. fine if use default primarybuttonclick it's click event parameter, contentdialogbuttonclickeventargs has getdeferral() method can used alter default setting closing messagedialog close parent contentdialog.

however when use custom buttons, event parameter routedeventargs , not contain getdeferral()

example:

//this works fine. validateform() call messagedialog alarms/warnings  private async void contentdialog_primarybuttonclick(contentdialog sender, contentdialogbuttonclickeventargs args) {      //save item      var deferral = args.getdeferral();      args.cancel = await validateform();      deferral.complete(); } 

but returns compilation error:

private async void savebutton_click(object sender, routedeventargs e) {      var deferral = e.getdeferral();      e.cancel = await validateform();      deferral.complete(); } 

what should enable getdeferral on normal/custom buttons click event? should cast parameter contentdialogbuttonclickeventargs? work? better work around?


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -