WPF Treeview 3级循环遍历所有节点

时间:2016-02-25 09:56:58

标签: wpf loops treeview nodes

我尝试循环到我的3级Treeview的每个节点,但ItemContainerGenerator.ContainerFromItem返回空值

chart.series[0].setData(marker_points,true);

TVI2为空

这是xaml

foreach (DataRowView obje in tvMain.Items)
            {
                TreeViewItem TVI = (TreeViewItem)tvMain.ItemContainerGenerator.ContainerFromItem(obje);

                foreach (DataRowView obje2 in TVI.Items)
                {
                    TreeViewItem TVI2 = (TreeViewItem)TVI.ItemContainerGenerator.ContainerFromItem(obje2);
                }

            }

非常感谢

0 个答案:

没有答案