Hi i fill the treeview via code and works well, but i need a way to asign a icon from a assigned imagelist on the nodes.
The Data assignemend is:
- ChildMember = id
- DisplayMember = Label
- ParentMember = pid
- Tag = ImageKey
- ValueMember = ImageKey
I have tested with the tag and the valuemember fields without success, the tag field is allways empty :(
I have tryed to assign the CollectionChanged event, ut it does not fire when the datasource is bound... !?
Any help would be great
Thx
Volkan Senguel
The Data assignemend is:
- ChildMember = id
- DisplayMember = Label
- ParentMember = pid
- Tag = ImageKey
- ValueMember = ImageKey
I have tested with the tag and the valuemember fields without success, the tag field is allways empty :(
I have tryed to assign the CollectionChanged event, ut it does not fire when the datasource is bound... !?
radTreeView1.Nodes.CollectionChanged += new Telerik.WinControls.Data.NotifyCollectionChangedEventHandler(Nodes_CollectionChanged); List<TreeItem> items = new List<TreeItem>(); { TreeItem t1 = new TreeItem(); t1.id = 1; t1.Label = "Home"; t1.ImageKey = "airplane"; items.Add(t1); } { TreeItem t1 = new TreeItem(); t1.id = 2; t1.pid = 1; t1.Label = "Level 2"; t1.ImageKey = "comments"; items.Add(t1); } radTreeView1.ValueMember = "id"; radTreeView1.ParentMember = "pid"; radTreeView1.DisplayMember = "Label"; radTreeView1.Tag = "ImageKey"; radTreeView1.DataSource = items;
void Nodes_CollectionChanged(object sender, Telerik.WinControls.Data.NotifyCollectionChangedEventArgs e) { RadTreeNode n = ((RadTreeNode)e.NewItems[0]); ((RadTreeNode)e.NewItems[0]).ImageKey = n.Tag.ToString(); }public class TreeItem { public int id { get; set; } public int pid { get; set; } public string Label { get; set; } public string ImageKey { get; set; } }Any help would be great
Thx
Volkan Senguel
