String GetTreeViewItemHeaderText(TreeViewItem _sourceItem)
        {
            EditableTextBlock l_EditableTextBlock = _sourceItem.Header as EditableTextBlock;

            if (l_EditableTextBlock != null)
            {
                return(l_EditableTextBlock.Text);
            }
            return(_sourceItem.Header.ToString());
        }
        public void addChild(TreeViewItem _sourceItem, TreeViewItem _targetItem)
        {
            // add item in target TreeViewItem
            TreeViewItem      item1 = new TreeViewItem();
            EditableTextBlock l_EditableTextBlock = new EditableTextBlock();
            EditableTextBlock l_SourceHeader      = _sourceItem.Header as EditableTextBlock;

            l_EditableTextBlock.Text = l_SourceHeader.Text;
            item1.Header             = l_EditableTextBlock;
            _targetItem.Items.Add(item1);
            foreach (TreeViewItem item in _sourceItem.Items)
            {
                addChild(item, item1);
            }
        }
        void    AddNewItem(String e_strText, TreeViewItem e_Parent)
        {
            TreeViewItem l_TreeViewItem = new TreeViewItem();

            l_TreeViewItem.AllowDrop = true;
            EditableTextBlock l_EditableTextBlock = new EditableTextBlock();

            l_EditableTextBlock.Text = e_strText;
            l_TreeViewItem.Header    = l_EditableTextBlock;
            e_Parent.Items.Add(l_TreeViewItem);
            if (f_AddNewItem != null)
            {
                f_AddNewItem(e_strText, e_Parent);
            }
            e_Parent.IsExpanded = true;
        }