ログイン情報が正しくない場合にエラーアラートを表示する登録画面を書いています。
5 に答える
一行で…
await new Windows.UI.Popups.MessageDialog("Man why did they have to make this so complicated in Win 8").ShowAsync();
Windowsストアアプリでは、 「こちらnew MessageDialog("My Message").ShowAsync();
を 参照してください」を参照してください。
メッセージ ボックスを Metro ベースのアプリケーションに追加する方法については、次の記事を参照してください。
http://msdn.microsoft.com/en-us/library/windows/apps/hh738361.aspx
どのような特定の状況について話しているのかわかりませんが、ユーザーインターフェイスで[OK]ボタンと[キャンセル]ボタンを使用する場合は、次を使用できます。
ScriptManager.RegisterClientScriptBlock(this, Page.GetType(), "alert", "confirm('You are about to confirm')?window.location='Yes':window.location='No';", true);
または、[OK]ボタンをクリックしてリダイレクトするだけの場合は、次を使用できます。
ScriptManager.RegisterClientScriptBlock(this, Page.GetType(), "alert", "alert('You are about to confirm');window.location='Yes';", true);
System.Web.UI名前空間を追加する必要があります
メッセージボックスを表示するボタンの完全なコードは次のとおりです。
private async void DisplayMessageButton_Click(object sender, RoutedEventArgs e)
{
MessageDialog messageDialog = new MessageDialog("Welcome to Windows 8 Store Apps", "Windows 8");
await messageDialog.ShowAsync();
}