private PUTreeViewItem GenerateTreeViewItem(PUTreeViewItemModel model) { var treeViewItem = new PUTreeViewItem() { Uid = model.Uid, Header = model.Header, Value = model.Value, Padding = model.Padding, }; foreach (var child in Generate(model.Items)) { treeViewItem.Items.Add(child); } model.PropertyChanged += delegate { treeViewItem.Header = model.Header; treeViewItem.Value = model.Value; treeViewItem.Padding = model.Padding; treeViewItem.Items.Clear(); foreach (var child in Generate(model.Items)) { treeViewItem.Items.Add(child); } }; return(treeViewItem); }
private void AppendItem(PUTreeViewItemModel model, PUTreeViewItem parent, int deepth) { foreach (var item in model.Items) { var treeViewItem = new PUTreeViewItem() { Header = item.Header, Value = item.Value, Padding = new Thickness(Padding.Left * 2, 0, 0, 0), }; parent.Items.Add(treeViewItem); if (item.Items != null && item.Items.Count != 0) { AppendItem(item, treeViewItem, deepth + 1); } } }