This question is locked. New answers and comments are not allowed.
Hello,
when the application displays the messagebox, if the user presses the back button instead of a button shown by the message, the application crashes.
How can I solve this problem?
Below is the code used to create the messagebox:
MessageBoxClosedEventArgs args = await RadMessageBox.ShowAsync(new CustomHeaderedContentControl[] {
new CustomHeaderedContentControl() { Title = AppResources.Salva, Message = AppResources.msgSalvaEMantieniMod },
new CustomHeaderedContentControl() { Title = AppResources.NonSalvare, Message = AppResources.msgNonSalvareMod },
new CustomHeaderedContentControl() { Title = AppResources.Annulla, Message = AppResources.msgContAModificare} },
AppResources.ModificheNonSalvate, AppResources.IlTestoEStatoModificato);
// ClickedButton will be null in the case when RadMessageBox is closed because the user pressed the hardware back button.
if (args.ClickedButton == null) { return; }
CustomHeaderedContentControl option = (CustomHeaderedContentControl)args.ClickedButton.Content;
if (option.Title == AppResources.Salva) { salvaTestoNuovo(); }
if (option.Title == AppResources.NonSalvare) { NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative)); }
when the application displays the messagebox, if the user presses the back button instead of a button shown by the message, the application crashes.
How can I solve this problem?
Below is the code used to create the messagebox:
MessageBoxClosedEventArgs args = await RadMessageBox.ShowAsync(new CustomHeaderedContentControl[] {
new CustomHeaderedContentControl() { Title = AppResources.Salva, Message = AppResources.msgSalvaEMantieniMod },
new CustomHeaderedContentControl() { Title = AppResources.NonSalvare, Message = AppResources.msgNonSalvareMod },
new CustomHeaderedContentControl() { Title = AppResources.Annulla, Message = AppResources.msgContAModificare} },
AppResources.ModificheNonSalvate, AppResources.IlTestoEStatoModificato);
// ClickedButton will be null in the case when RadMessageBox is closed because the user pressed the hardware back button.
if (args.ClickedButton == null) { return; }
CustomHeaderedContentControl option = (CustomHeaderedContentControl)args.ClickedButton.Content;
if (option.Title == AppResources.Salva) { salvaTestoNuovo(); }
if (option.Title == AppResources.NonSalvare) { NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative)); }