Example #1
0
 public static TreeViewItem GetTreeViewItemFromXElement(this XElement xElement)
 {
     var treeViewItem = new TreeViewItem {DataContext = xElement};
     treeViewItem.UpdateTreeViewItem(xElement);
     return treeViewItem;
 }
        private static void Edit(TreeViewItem selected)
        {
            if (selected == null)
            {
                return;
            }
            var element = ((XElement) selected.DataContext);
            var dialog = new XElementDialog(element, false);
            dialog.ShowDialog();
            if (!dialog.DialogResult.HasValue || !dialog.DialogResult.Value) return;
            var xElement = dialog.GetElement();

            if (!DBFactory.GetData().Save(xElement))
            {
                MessageBox.Show("update Tree item Failed.");
                return;
            }
            selected.UpdateTreeViewItem(xElement);
        }
 private static void UpdateRelatedTreeViewItem(TreeViewItem treeViewItem, XElement xElement)
 {
     treeViewItem.DataContext = xElement;
     treeViewItem.UpdateTreeViewItem(xElement);
 }