C++ UWP 使用对话框控件 ContentDialog

处理回调需要用到C++/CX 异步编程

void _xxx::MainPage::bre_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
    
    
	ContentDialog^ dialog = ref new ContentDialog;
	dialog->Title = "标题";
	dialog->Content = "内容";
	dialog->PrimaryButtonText = "确定";
	dialog->CloseButtonText = "取消";
	//设置默认高亮按钮
	dialog->DefaultButton = ContentDialogButton::Close;
	IAsyncOperation<ContentDialogResult>^ task = dialog->ShowAsync();
	create_task(task).then([this](ContentDialogResult result) {
    
    
		if (result == ContentDialogResult::Primary){
    
    
			//操作
		}
	});
}

猜你喜欢

转载自blog.csdn.net/u011570312/article/details/112794997
UWP
今日推荐