messgaePrompt.Hide() not working

Aug 29, 2013 at 11:47 AM
I am displaying a MessagePrompt, but can't get the prompt to go away when I am done.

Here is my code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using Coding4Fun.Toolkit.Controls;

namespace EasySchedule
    public  partial class LicenseMessage : UserControl

        public static boundString profileMsgTextBoxText = new boundString();
        static MessagePrompt messagePrompt = new MessagePrompt { };

        public LicenseMessage()

        private void upgradeButton_Click(object sender, RoutedEventArgs e)
            // Do stuff

        private void trialButton_Click(object sender, RoutedEventArgs e)
            // Do stuff

        private void laterButton_Click(object sender, RoutedEventArgs e)
            // Do stuff

        public static void Show(string titleMsg, string bodyMsg, bool isTrial)
            profileMsgTextBoxText.Name = titleMsg;

            MessagePrompt messagePrompt = new MessagePrompt { };
            LicenseMessage newMsg = new LicenseMessage();
            messagePrompt.Body = newMsg;
            newMsg.titleText.Text = titleMsg;
            newMsg.messageText.Text = bodyMsg;
            if (isTrial)
                newMsg.trialButton.Visibility = Visibility.Visible;
                newMsg.trialButton.Visibility = Visibility.Collapsed;

And here is the XAML:
<UserControl x:Class="EasySchedule.LicenseMessage"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    d:DesignHeight="480" d:DesignWidth="480">

    <Grid x:Name="LayoutRoot" Background="{StaticResource PhoneChromeBrush}">
            <TextBlock Name="titleText" Text="Test123" FontSize="{StaticResource PhoneFontSizeLarge}" Margin="0,0,0,32" />
            <TextBlock Name="messageText" Text="Rename Profile:" FontSize="{StaticResource PhoneFontSizeMedium}" Margin="0,0,0,32" />
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                <Button Name="upgradeButton" Content="Upgrade" Click="upgradeButton_Click" HorizontalAlignment="Center"/>
                <Button Name="trialButton" Content="Trial" Click="trialButton_Click" Visibility="Collapsed"/>
                <Button Name="laterButton" Content="Later" Click="laterButton_Click"/>
The control is called like this:
                    LicenseMessage licenseMessage = new LicenseMessage();
                    LicenseMessage.Show("Trial Message", "This is a test of my new messaging system.\n\nThis is only a test", false);
When I click on the buttons, their Click event is fired, but the messagePrompt.Hide() call does not make the MessagePrompt go away.

Any idea whet I am doing wrong?
Aug 29, 2013 at 11:54 AM
Never mind. I just figured it out.

I had messagePrompt defined twice. I deleted the definition that was in the Show() method and all is well.
Aug 29, 2013 at 6:31 PM
I suggest doing a class wide private with an underscore ala _msgPrompt to prevent that issue