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
Post a Comment