Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9116581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:42:33+00:00 2026-06-17T04:42:33+00:00

Code for creating the CustomMessageBox : CustomMessageBox is a property, and not a reference

  • 0

Code for creating the CustomMessageBox:

CustomMessageBox is a property, and not a reference to the C# Class in the Toolkit.

CustomMessageBox.Dismissed += (dismissSender, dismissedEvent) =>
{
    switch (dismissedEvent.Result)
    {
        case CustomMessageBoxResult.LeftButton:
            PlaceCall(clickedFavorite.Name, clickedFavorite.PhoneNo);
            break;
        case CustomMessageBoxResult.RightButton:
            HERE ---> SendText(clickedFavorite.PhoneNo);
            break;
    }
};

Code for SendText() method:

private void SendText(String phoneNo)
{
    var smsTask = new SmsComposeTask
                      {
                          To = phoneNo
                      };

    smsTask.Show();
}

Thing is when the SmsComposeTask has started, the Phone navigates to the SMS application, which is correct.

If the user then decides to go back, with the Hardware Back Button, the SMS application closes and the phone shows my app again – but immediately closes, caused by a NullPointerException:

   at Microsoft.Phone.Controls.CustomMessageBox.ClosePopup(Boolean restoreOriginalValues)
   at Microsoft.Phone.Controls.CustomMessageBox.<>c__DisplayClass4.<Dismiss>b__1(Object s, EventArgs e)
   at Microsoft.Phone.Controls.Transition.OnCompleted(Object sender, EventArgs e)
   at MS.Internal.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)

I have also tried to override the OnBackKeyPress event, like this:

protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
{
    if (CustomMessageBox != null && CustomMessageBox.IsEnabled)
    {
        e.Cancel = true;
    }
    else
    {
        base.OnBackKeyPress(e);
    }
}

Does anyone know what to do?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T04:42:35+00:00Added an answer on June 17, 2026 at 4:42 am

    I have found a solution to my own problem. Instead of using the faulty CustomMessageBox, I found Coding4Fun Windows Phone Toolkit which provides a by far, more stable message box called MessagePrompt – here’s how to use it.

    Create buttons

    var smsButton = new Button { Content = "SMS" };
    smsButton.Click += (o, args) =>
    {
        // do something
    };
    
    var buttonList = new List<Button>
    {
        smsButton
    };
    

    Create the actual message prompt

    var msgPrompt = new MessagePrompt
    {
        Title = "Message Prompt Title",
        Body = new TextBlock { Text = "Text for the Body", FontSize = 25, TextWrapping = TextWrapping.Wrap },
        ActionPopUpButtons = buttonList
    };
    

    Show it

    msgPrompt.Show()
    

    No bullocks

    The good thing, which I have experienced with this MessagePrompt is that you are not bound to two static Left and Right buttons like with CustomMessageBox.

    And if you want, you can set the Body property to a whole new XAML page, which makes this control flexible.

    Reference: Coding4Fun WP7 Message Prompt in depth

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have found a code creating a timeout function here , which does not
So I have the following code creating a grid of buttons using tkinter: class
This is my code for creating Json response for jqGrid and for new keyword
I have the following code for creating tabs. It works at the end of
I have this webdav code thats creating folders in SharePoint: HttpWebRequest request = (System.Net.HttpWebRequest)HttpWebRequest.Create(folderAddress);
What would be the code for creating a table with two foreign keys? I
Can I avoid third party code from creating new threads, starting new VMs, or
Eariler I happily used the following code for creating form elements (inside Zend_Form descendant):
I was trying to add some non-production test code by creating a 3rd partial
i need to make my window top level when i need. Code of creating

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.