This is a migrated thread and some comments may be shown as answers.

Result is always 'Cancel' after upgrade

7 Answers 61 Views
MessageBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Matthew
Top achievements
Rank 1
Matthew asked on 13 Jun 2012, 12:14 PM
OK guys, I just upgraded to the new version you guys released the other day. I've got a basic 'Do you wanna Delete?' message box and the DialogResult on the MessageBoxClosedEventArgs is always coming back as 'Cancel' now. What changed? Code below; if I'm doing something wrong now please let me know.

Action<MessageBoxClosedEventArgs> closedHandler =
    e =>
    {
        if (e.Result != DialogResult.OK)
            return;
 
        Delete();
    };
 
RadMessageBox.Show(AppResources.DeleteText, MessageBoxButtons.YesNo, AppResources.DeleteItemMessage, closedHandler: closedHandler);

7 Answers, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 13 Jun 2012, 01:21 PM
Hello Matthew,

Thank you for reporting this. This is a bug that resulted from a new feature that we added to RadMessageBox. This feature is a fallback mechanism that switches to the native MessageBox when RadMessageBox fails to open for some reason.

The code that is currently executing in the build you are using is this:

internal MessageBoxClosedEventArgs(Button clickedButton = null, bool isCheckBoxChecked = false, int buttonIndex = -1)
{
    this.ClickedButton = clickedButton;
    this.IsCheckBoxChecked = isCheckBoxChecked;
 
    int index = buttonIndex != -1 ? buttonIndex : this.ButtonIndex;
    this.Result = buttonIndex == 0 ? DialogResult.OK : DialogResult.Cancel;
}

Notice how the buttonIndex variable is checked twice. This is wrong. It should be this instead:
internal MessageBoxClosedEventArgs(Button clickedButton = null, bool isCheckBoxChecked = false, int buttonIndex = -1)
{
    this.ClickedButton = clickedButton;
    this.IsCheckBoxChecked = isCheckBoxChecked;
 
    int index = buttonIndex != -1 ? buttonIndex : this.ButtonIndex;
    this.Result = index == 0 ? DialogResult.OK : DialogResult.Cancel;
}

This method is the constructor of the MessageBoxClosedEventArgs class. If it is critical for you, you can immediately rebuild RadControls for Windows Phone from source (you have access to the source code) with this small modification and use the custom build. If it is not critical we will release an internal build with the fix shortly.

Again thank you for reporting this. Your Telerik points have been updated.
All the best,
Victor
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Matthew
Top achievements
Rank 1
answered on 13 Jun 2012, 02:54 PM
I can wait. I don't plan on publishing what I'm working on for months. Thanks for the update!
0
Ross
Top achievements
Rank 1
answered on 18 Jul 2012, 08:38 AM
I've just hit the same issue today, so nice to have found this thread to confirm.  Any idea when the fix will get into an updated build?



Thanks,

Ross

0
Victor
Telerik team
answered on 18 Jul 2012, 10:43 AM
Hello Ross,

This issue is already fixed, just update to the latest internal build. It is available for download from your account on the Telerik website.

Kind regards,
Victor
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Ross
Top achievements
Rank 1
answered on 18 Jul 2012, 10:52 AM
Confirmed.  Thanks Victor.
0
Robert
Top achievements
Rank 1
answered on 10 Nov 2012, 07:46 AM
I downloaded the latest internal build of RadControls for Windows Phone 8 2012.3.1109.0 and I'm still getting this issue.

Where can I find the source to make the modification myself?
0
Robert
Top achievements
Rank 1
answered on 10 Nov 2012, 06:24 PM
Nevermind, it is fixed.
 
I was hanging on to past references. Blew out the bin folder and re-added the references..
Tags
MessageBox
Asked by
Matthew
Top achievements
Rank 1
Answers by
Victor
Telerik team
Matthew
Top achievements
Rank 1
Ross
Top achievements
Rank 1
Robert
Top achievements
Rank 1
Share this question
or