MessageBox のデフォルトのボタンは変更できません。より良いことMicrosoft Phone Toolkit
に、これで、希望する左右のボタンでカスタム メッセージ ボックスを作成でき、それらのボタンがクリックされた場合の機能を設定することもできます。
NuGet をダウンロードするには、ここをタップします。プロジェクトで左クリックを押してからNuGetパッケージを管理し、Microsoft Phone Toolkitを検索します。パッケージが見つかったら、インストールを押して、以下のコードを使用します。
CustomMessageBox messageBox = new CustomMessageBox()
{
Title = "Inport photo", //your title
Message = "Select from where to import photo", //your message
RightButtonContent = "Yes", // you can change this right and left button content
LeftButtonContent = "No",
};
messageBox.Dismissed += (s2, e2) =>
{
switch (e2.Result)
{
case CustomMessageBoxResult.RightButton:
//here your function for right button
break;
case CustomMessageBoxResult.LeftButton:
//here your function for left button
break;
default:
break;
}
};
messageBox.Show();