简体   繁体   中英

add radtreeview items to radtreeview root programmatically

Platform: WPF, .NET 4, Visual Studio 2010
XAML code is as below:

<telerik:RadTreeView x:Name="mytree"  
IsOptionElementsEnabled="True"  
IsLineEnabled="True"    
HorizontalAlignment="Left" AllowDrop="True"> 
<telerik:RadTreeViewItem Header="Root of the Tree" x:Name="myroot" AllowDrop="True">  

I intend to add a node in the code behind like the following way:

RadTreeViewItem treeviewitem = new RadTreeViewItem();  
treeviewitem.Header = "some text here";  
myroot.Add(treeviewitem);

However it seems like there is no Add method in the radtreeviewitem class. Intellisense does not give that option when I try to do it. How should I proceed?

使用“ myRoot.Items.Add(treeviewitem)”代替。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM