This is a migrated thread and some comments may be shown as answers.

Set TreeViewItem Name from code behind

1 Answer 117 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Harsh
Top achievements
Rank 1
Harsh asked on 06 Feb 2009, 07:53 AM
Hi,
I am binding my tree with the collection.

 


Now while adding an item to the tree view I want to set the header and the name of the Item node. 

Currently I am able to set the header of the item added but when I try to set the name I get an error. 

RadTreeViewItem
objRadItem;

 

 

 

 

objRadItem.Items.Add(

new RadTreeViewItem()

 

{

Header = "Harsh",

 

//Name = Convert.ToString(12)

 

 

 

});

How can I set the name of an item added?

 

1 Answer, 1 is accepted

Sort by
0
Tihomir Petkov
Telerik team
answered on 06 Feb 2009, 08:25 AM
Hi Harsh,

I wasn't able to reproduce your issue - setting the name from the code-behind works on my machine. Can you create a small project that is just isolating the issue and send it to me so that I can take a look.

By the way, why do you need to set the Name property in the code-behind? As you can read on MSDN, "The name provides a reference so that code-behind, such as event handler code, can refer to a markup element after it is constructed during processing by a XAML processor".

Sincerely yours,
Tihomir Petkov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
TreeView
Asked by
Harsh
Top achievements
Rank 1
Answers by
Tihomir Petkov
Telerik team
Share this question
or