public TreeNodeVM(TreeNode node, TreeNodeVM parent = null) { Node = node; Value = node.Value; Parent = parent; Children = new ObservableCollection <TreeNodeVM>(); foreach (TreeNode child in node.Children) { Children.Add(new TreeNodeVM(child, this)); } Children.CollectionChanged += Children_CollectionChanged; }
private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { TreeNodeVM vm = d as TreeNodeVM; vm.Node.Value = (int)e.NewValue; }