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

[Solved] Adding icons to RadTreeViewItem

1 Answer 172 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Joe
Top achievements
Rank 1
Joe asked on 12 May 2009, 03:54 PM
I want to add a text and icon to a RadTreeViewItem, so i'm doing something like this:

 

for (int i = 0; i < list.Count; i++)  
 
{  
    RadTreeViewItem newItem = new RadTreeViewItem();  
    StackPanel sp = new StackPanel();  
 
    image ic=new Image() { Height = 16, Width = 16, Source = img };  
 
    sp.Children.Add(ic);  
 
 
 
    TextBlock text=new TextBlock();  
    text.Text=list[i].label;  
    sp.Children.Add(text);  
 
 
    newItem.Header = sp;  
}  
 

I can't see the image, how can i resolve this?

1 Answer, 1 is accepted

Sort by
0
Joe
Top achievements
Rank 1
answered on 12 May 2009, 04:26 PM
Opps, is working....

Btw, To put text and icon in the same line, i used a WrapPanel. 

A cool thing to do: Replace the arrow with +
Tags
TreeView
Asked by
Joe
Top achievements
Rank 1
Answers by
Joe
Top achievements
Rank 1
Share this question
or