【问题标题】:Why is ItemsControl.ItemsPanelRoot null by default?为什么 ItemsControl.ItemsPanelRoot 默认为空?
【发布时间】:2018-01-06 02:45:22
【问题描述】:

ItemsPanelRoot Docs

如果 ItemsPanel 默认是 StackPanel 的模板(参见docs),那么 ItemsPanelRoot 不应该默认返回 StackPanel 的实例吗?

【问题讨论】:

  • 这是一个问题,你在做什么?
  • 我已经找到了解决方案。我试图过早访问 ItemsPanelRoot,因此它为空。
  • 我没有问下面的答案是什么。
  • 我觉得我已经回答了你的问题。我需要引用 ItemsPanelRoot 的原因超出了这个问题的范围。

标签: xaml uwp


【解决方案1】:

看起来它是空的,因为我还没有设置 ItemsSource。另外,即使设置了ItemsSource,我也需要等待Loaded事件。

【讨论】:

  • 感谢您分享解决方案,您节省了我很多时间。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2010-12-17
  • 2015-05-11
  • 2018-01-26
  • 2023-04-06
相关资源
最近更新 更多