【Win UI 3.0 contentdialog 报错 Value does not fall within the expected range】

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();
【Win UI 3.0 contentdialog 报错 Value does not fall within the expected range】
https://blog.async.website/index.php/archives/2732/
本文作者 snowysong@live.com
发布时间 2021-12-29
许可协议 CC BY-NC-SA 4.0
仅有 1 条评论
  1. 评论头像

    Great content! Keep up the good work!

    Keeper Tax January 4th, 2022 at 04:10 pm 回复
发表新评论