我也想知道。在wpf里没有.Controls属性,只在WinForm里有,不知道怎么办了。

解决方案 »

  1.   

    用Content属性得到页面上的内容
    System.Windows.Controls.Decorator类型用Child属性取内容
    System.Windows.Controls.Panel类型用Children属性取内容不如直接给个name属性直接用就可以了。
    比如想对System.Windows.Controls.Panel中很多相同类型的控件遍历操作,
    可以给这个System.Windows.Controls.Panel控件起个name,
    定位到这个System.Windows.Controls.Panel控件,
    然后用Children属性遍历里面的控件
      

  2.   

    ItemsControl有个ItemCollection
    Panel有Children属性  都可以遍历2楼正解
      

  3.   

    foreach (System.Windows.UIElement element in BaseGrid.Children)
    {
    //
    }