private void OnRefreshClick(object sender, RoutedEventArgs e) { treeView.Items.Clear(); foreach (Contact contact in Contact.GetContacts()) { ContactTreeNode contactTreeNode = new ContactTreeNode(contact); treeView.Items.Add(contactTreeNode); } }
private void OnAddContactClick(object sender, RoutedEventArgs e) { Contact contact = new Contact { FirstName = "New", LastName = "Contact" }; ContactTreeNode contactTreeNode = new ContactTreeNode(contact); treeView.Items.Add(contactTreeNode); contactTreeNode.IsSelected = true; }
private void treeView_SelectedItemChanged(object sender, RoutedEventArgs e) { detailPanel.Children.Clear(); ContactTreeNode contactTreeNode = treeView.SelectedItem as ContactTreeNode; if (contactTreeNode != null) { detailPanel.Children.Add(new ContactControl(contactTreeNode.Contact)); } }
protected override void OnInitialized(EventArgs e) { base.OnInitialized(e); Entity.Initialize(); foreach (Contact contact in Contact.GetContacts()) { ContactTreeNode contactTreeNode = new ContactTreeNode(contact); treeView.Items.Add(contactTreeNode); } }