You must set XamlRoot :
For example, in the Button click :
Windows.UI.Xaml.DependencyObject parent = ((Windows.UI.Xaml.FrameworkElement)sender).Parent;
dialog.XamlRoot = ((Windows.UI.Xaml.UIElement)parent).XamlRoot;
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi I am using the XAML Islands technology in Winforms .net core 3.1.
Now under a UWP Button click I am trying the following:
ContentDialog dialog = new ContentDialog();
dialog.Title = "Save your work?";
dialog.PrimaryButtonText = "Save";
dialog.SecondaryButtonText = "Don't Save";
dialog.CloseButtonText = "Cancel";
dialog.DefaultButton = ContentDialogButton.Primary;
dialog.Content = "Somethng";
var result = await dialog.ShowAsync();
But with this code, I am getting the following exception:
What is the problem?
Does content dialog have a problem in WinForms?
Also how do I add a keyboard Accelerator to the button in Winforms c#?
You must set XamlRoot :
For example, in the Button click :
Windows.UI.Xaml.DependencyObject parent = ((Windows.UI.Xaml.FrameworkElement)sender).Parent;
dialog.XamlRoot = ((Windows.UI.Xaml.UIElement)parent).XamlRoot;