private void cbNode_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (cbNode.SelectedIndex == 0) { btnSave.Content = "Add"; tbId.IsEnabled = true; SelectedChildLinks.Clear(); lvParents.ItemsSource = new List <Link>(); lvChilds.ItemsSource = new List <Link>(); Variants = new List <Variant>(); lvVariants.ItemsSource = Variants; tbId.Text = (knowlegeBaseManager.MaxNodeId + 1).ToString(); cbChilds.ItemsSource = GetChildItems(); } else if (cbNode.SelectedIndex > 0) { btnSave.Content = "Save"; tbId.IsEnabled = false; Node node = knowlegeBaseManager.Base.Nodes.Find(x => x.Id == (int)(cbNode.SelectedItem as ContentControl).Tag); tbId.Text = node.Id.ToString(); tbId.IsEnabled = false; SelectedChildLinks.Clear(); SelectedChildLinks = new List <Link>(node.Childs); Variants = new List <Variant>(node.Variants); lvChilds.ItemsSource = SelectedChildLinks; lvVariants.ItemsSource = Variants; cbChilds.ItemsSource = GetChildItems(SelectedChildLinks, node.Id); lvParents.ItemsSource = knowlegeBaseManager.GetParentLinks(node.Id); } cbChilds.Items.Refresh(); cbChilds.SelectedIndex = -1; }