문제

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