private TreeViewItem getTree(Kriterium objekt) { List <Kriterium> unterkriterien = objekt.getUnterKriterium(db); TreeViewItem tree = new TreeViewItem(); List <TreeViewItem> branch = new List <TreeViewItem>(); TreeViewItem temp_item = new TreeViewItem(); foreach (Kriterium temp_objekt in unterkriterien) { tree.Header = objekt.ToString(); branch.Add(getTree(temp_objekt)); } if (unterkriterien.Count == 0) { tree.Header = objekt.ToString(); } tree.ItemsSource = branch; return(tree); }