Hi @Matthew Armshaw ,
Welcome to Microsoft Q&A!
I am trying to add a ContentDialog item to UWP Blank App (C++/WinRT) project. With a fresh project of this type I choose Add New Item > XAML > ContentDialog.
The ContentDialog template you choose in Visual Studio generates C++/CX code, which is not C++/WinRT. It is recommended to add ContentDialog via code in C++/WinRT project.
using namespace winrt::Windows::UI::Xaml::Controls;
ContentDialog dialog;
dialog.Title(box_value(L"Error"));
dialog.Content(box_value(L"Please check and try again."));
dialog.CloseButtonText(L"OK");
dialog.ShowAsync();
Thank you.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.