I'm trying to display a message to the user when they click a button but I'm not sure how to achieve this in Windows phone development.I know in Android you can use a toast but I can't find something similar for Windows phone, what I have found is this http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj662938(v=vs.105).aspx but its not the correct solution as it shows a notification at the title bar.

Does anyone have a simple solution to displaying a prompt to the user or something similar?

I'm looking for something similar to this:

Sample user prompt

有帮助吗?

解决方案

MessageBox.Show("Success", "Location saved.", MessageBoxButton.OK);

You can use MessageBox to display simple information/prompts to the user in WP. More info: http://msdn.microsoft.com/en-us/library/windowsphone/develop/ms598690(v=vs.105).aspx

其他提示

Windows phone toast notification. This may help you a lot. Download Coding4Fun.Phone.Toolkit v1.2 from here and add reference in your solution. Here is sample code how to display a custom notification(message) on button click may this will help you.

private void btnCustomizedToastPrompt_Click(object sender, RoutedEventArgs e)
{
     SolidColorBrush gray = new SolidColorBrush(Colors.LightGray);
     SolidColorBrush orange = new SolidColorBrush(Color.FromArgb(200, 255, 117, 24));

    ToastPrompt toast = new ToastPrompt
    {
        Background = gray,
        Foreground = orange,
        Title = "Customized",
        Message = "Custom colors",
        FontSize = 30,
        TextOrientation = System.Windows.Controls.Orientation.Vertical,
        ImageSource =
            new BitmapImage(new Uri("ApplicationIcon.png", UriKind.RelativeOrAbsolute))
    };

    toast.Completed += toast_Completed;
    toast.Show();
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top