0x00.相关

  • Win UI 3.0
  • ContentDialog
  • XamlRoot

0x01.现象

使用win ui 3.0,创建content dialog,使用showasync(),报错Value does not fall within the expected range.

ContentDialog contentDialog = new ContentDialog();
contentDialog.Content = new RSSEditContentDialog();
var res = contentDialog.ShowAsync();

0x02.纠正方法

ContentDialog contentDialog = new ContentDialog();
contentDialog.Content = new RSSEditContentDialog();
contentDialog.XamlRoot = Content.XamlRoot;//增加这一行
var res = contentDialog.ShowAsync();