Result is always 'Cancel' after upgrade

8 posts, 0 answers
  1. Matthew
    Matthew avatar
    32 posts
    Member since:
    Oct 2011

    Posted 13 Jun 2012 Link to this post

    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);
  2. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 13 Jun 2012 Link to this post

    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 >>

  3. DevCraft banner
  4. Matthew
    Matthew avatar
    32 posts
    Member since:
    Oct 2011

    Posted 13 Jun 2012 Link to this post

    I can wait. I don't plan on publishing what I'm working on for months. Thanks for the update!
  5. Ross
    Ross avatar
    7 posts
    Member since:
    Sep 2006

    Posted 18 Jul 2012 Link to this post

    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

  6. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 18 Jul 2012 Link to this post

    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.

  7. Ross
    Ross avatar
    7 posts
    Member since:
    Sep 2006

    Posted 18 Jul 2012 Link to this post

    Confirmed.  Thanks Victor.
  8. Robert
    Robert avatar
    9 posts
    Member since:
    Nov 2012

    Posted 10 Nov 2012 Link to this post

    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?
  9. Robert
    Robert avatar
    9 posts
    Member since:
    Nov 2012

    Posted 10 Nov 2012 Link to this post

    Nevermind, it is fixed.
     
    I was hanging on to past references. Blew out the bin folder and re-added the references..
Back to Top
DevCraft banner