Windows Phone 7 Coding4Fun控件简介

    由于windows phone自带的弹出框实在太过简陋,功能也不够强大,这时就可以利用第三方控件Codig4Fun来实现类似silverlight中ChildWindow的作用。

Coding4Fun的下载地址为:http://coding4fun.codeplex.com/ 

    1.MessagePrompt 消息弹出框

 

private void ShowMessage_Click(object sender, EventArgs e)

        {

            MessagePrompt msg = new MessagePrompt();

            msg.Title = "This is a Message";

            msg.Message = "Message";

            msg.Show();

        }

 

  2.PasswordInputPrompt 输入密码对话框

 

 private void ShowPassWord_Click(object sender, EventArgs e)

        {

            PasswordInputPrompt password = new PasswordInputPrompt();

            password.Title = "InputPassWord";

            password.Message = "Please input Password";

            //用于获取输入信息的返回值,返回信息保存在e.Result中

            password.Completed += new EventHandler<PopUpEventArgs<string, PopUpResult>>(password_Completed);

        }



        void password_Completed(object sender, PopUpEventArgs<string, PopUpResult> e)

        {



            if (e.PopUpResult == PopUpResult.Ok)

            {

                //点击ok后执行

            }

            else if (e.PopUpResult == PopUpResult.Cancelled)

            {

                //点击cancel后执行

            }

        }

 

    3.InputPrompt 输入框,用法和密码弹出框类似

    4.AboutPrompt 关于对话框,起到说明作用

    5.ToastPrompt 在屏幕上显示消息,然后消失

其中窗体的body部分可以自由替换为其他UserControl:

 

private void About_Click(object sender, EventArgs e)

        {

            AboutPrompt about = new AboutPrompt();

            about.Body = new About();

            about.Show();

        }

 

 

 

 

 

 

你可能感兴趣的:(windows phone)