Dear Experts,
am using tree view selection change event to get the selected item and am able to get the selected item by using the below code
void treeView_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangedEventArgs e)
{
RadTreeView tv = e.OriginalSource as RadTreeView;
//get the selected Item from the treeview.
selectedItem = tv.SelectedItem as RadTreeViewItem;
if (treeView.SelectedContainer != null && this.treeView.SelectedContainer != selectedItem)
{
this.treeView.SelectedContainer.IsInEditMode = false;
}
if (selectedItem != null)
{
selectedItem.IsInEditMode = true;
selectedItem.BeginEdit();
}
}
and i have add button_click event ann call the add method as shown below
private void AddItem()
{
if (selectedItem == null)
{
RadTreeViewItem newItem = new RadTreeViewItem()
{
Header = "New root"
};
treeView.Items.Add(newItem);
}
else
{
RadTreeViewItem newItem = new RadTreeViewItem()
{
Header = "New Child"
};
selectedItem.Items.Add(newItem);
}
The problem is when i add the new node, and its in editable, and am able to edit, but when click on the each node in the treeview all the item in the text gets disabled. i don't whats wrong in my code.
i need to add the new node with the edit functionality.
Thanks in Advance.
am using tree view selection change event to get the selected item and am able to get the selected item by using the below code
void treeView_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangedEventArgs e)
{
RadTreeView tv = e.OriginalSource as RadTreeView;
//get the selected Item from the treeview.
selectedItem = tv.SelectedItem as RadTreeViewItem;
if (treeView.SelectedContainer != null && this.treeView.SelectedContainer != selectedItem)
{
this.treeView.SelectedContainer.IsInEditMode = false;
}
if (selectedItem != null)
{
selectedItem.IsInEditMode = true;
selectedItem.BeginEdit();
}
}
and i have add button_click event ann call the add method as shown below
private void AddItem()
{
if (selectedItem == null)
{
RadTreeViewItem newItem = new RadTreeViewItem()
{
Header = "New root"
};
treeView.Items.Add(newItem);
}
else
{
RadTreeViewItem newItem = new RadTreeViewItem()
{
Header = "New Child"
};
selectedItem.Items.Add(newItem);
}
The problem is when i add the new node, and its in editable, and am able to edit, but when click on the each node in the treeview all the item in the text gets disabled. i don't whats wrong in my code.
i need to add the new node with the edit functionality.
Thanks in Advance.