有没有办法获得UIElementCollection中的项目?

Luk*_*uke 0 c# collections wpf

我在网格中有一堆CheckBoxes.我想访问它们,以便我可以根据启动时的注册表值将它们设置为选中或取消选中.

我已将Grid的子项作为UIElementCollection,并过滤掉其他类型..但是,似乎没有任何方法可以访问存储在集合中的数据.有这么简单的方法吗?

Rob*_*evy 5

UIElementCollectionIEnumerable这样你可以循环它...

foreach( UIElement child in myUIElementCollection)
{
}
Run Code Online (Sandbox Code Playgroud)