Windows Phone 7で確認ダイアログを作成するにはどうすればよいですか?howto Windowsの電話機7で確認ダイアログを作成しますか?
私はこれをどのように行うことができます
私はアイテムを削除することが可能なアプリを持っている、誰かが削除クリックしたとき、私は彼に、彼らは「確認」をクリックするか、「中止」することができます確認ダイアログを取得したい
?Windows Phone 7で確認ダイアログを作成するにはどうすればよいですか?howto Windowsの電話機7で確認ダイアログを作成しますか?
私はこれをどのように行うことができます
私はアイテムを削除することが可能なアプリを持っている、誰かが削除クリックしたとき、私は彼に、彼らは「確認」をクリックするか、「中止」することができます確認ダイアログを取得したい
?ここに私が使用する方法があります。ところで、より良いユーザーエクスペリエンスと一貫性のために、「確認」または「中止」ではなく、「削除」および「キャンセル」という言葉を使用することを検討してください。
public static MessagePromptResult Show(string messageBoxText, string caption, string button1, string button2)
{
int? returned = null;
using (var mre = new System.Threading.ManualResetEvent(false))
{
string[] buttons;
if (button2 == null)
buttons = new string[] { button1 };
else
buttons = new string[] { button1, button2 };
Microsoft.Xna.Framework.GamerServices.Guide.BeginShowMessageBox(
caption,
messageBoxText,
buttons,
0, // can choose which button has the focus
Microsoft.Xna.Framework.GamerServices.MessageBoxIcon.None, // can play sounds
result =>
{
returned = Microsoft.Xna.Framework.GamerServices.Guide.EndShowMessageBox(result);
mre.Set(); // could have done it all without blocking
}, null);
mre.WaitOne();
}
if (!returned.HasValue)
return MessagePromptResult.None;
else if (returned == 0)
return MessagePromptResult.Button1;
else if (returned == 1)
return MessagePromptResult.Button2;
else
return MessagePromptResult.None;
}
Microsoft.Xna.Framework.GamerServicesへの参照をプロジェクトに追加する必要があります。
キャンセル/ OKがあなたのために十分であるならば、あなたは
むしろ削除を確認するためにユーザに尋ねるよりも、通常のMessageBox.Showに固執する可能性は、あなたがユーザーに能力を与えると考えられているように、「非削除」アイテム?
これはもう少しうまくいくかもしれませんが、アプリのコンテキストで意味がある場合、ユーザーエクスペリエンスがはるかに向上します。
あなたはこれを使用することができます。
[WP7の警告]ダイアログ](の
が重複する可能性http://stackoverflow.com/questions/:
は、このようなダイアログに何かを表示します4475602/wp7-alert-dialog) –