ContentDialog^
をUWP C++アプリケーションで使用しようとしています。 MessageDialog^
を使えば、簡単にボタンを設定し、それらがUWP C++ ContentDialog PrimaryButtonCommandまたはPrimaryButtonClick
MessageDialog^ msg = ref new MessageDialog("Data changed - Save?");
msg->Title = "Warning";
// Add commands and set their callbacks.
UICommand^ continueCommand = ref new UICommand("Yes", ref new UICommandInvokedHandler(this, &MainPage::CommandInvokedHandler));
UICommand^ upgradeCommand = ref new UICommand("No", ref new UICommandInvokedHandler(this, &MainPage::CommandInvokedHandler));
UICommand^ cancelCommand = ref new UICommand("Cancel", ref new UICommandInvokedHandler(this, &MainPage::CommandInvokedHandler));
に触れたとき、あなたは簡単に
void MainPage::CommandInvokedHandler(Windows::UI::Popups::IUICommand^ command)
{
// Display message
if (command->Label == "Yes") {
Save();
} else if (command->Label == "No") {
Skip();
} else if (command->Label == "Cancel") {
//do nothing
}
}
によってCommandInvokedHandler
に送信された値が、しかし、コンテンツダイアログが異なり、完全に機能にアクセスすることができます呼び出すWindows::UI::Popups::UICommand
コマンドすることができます。それは...私はどちらかのいくつかの(未知の奇妙な)理由Windows::UI::Xaml::Input::ICommand
完全に異なるを使用してプロパティdialog->PrimaryButtonCommand
を設定する必要があり、この
TextBox^ inputTextBox = ref new TextBox();
inputTextBox->AcceptsReturn = false;
inputTextBox->Height = 32;
ContentDialog^ dialog = ref new ContentDialog();
dialog->Content = inputTextBox;
dialog->Title = "Rename";
dialog->IsSecondaryButtonEnabled = true;
dialog->PrimaryButtonText = "Ok";
dialog->SecondaryButtonText = "Cancel";
dialog->ShowAsync();
よう
を作成していますか私はdialog->PrimaryButtonClick
を使用する必要がありますか?
どこのC++のサンプルを見つけるのにも苦労しています。ドキュメンテーションは何も解決しません。