Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show more that one image in the radtreeview item (wpf - telerik )

I am adding image to the radtreeviewitem from resources programatically using the below code.

"/myAssembley;component/Resources/image1.png"

and the image is displaying successfully. Now i need to add another image which needs to be displayed next to the first image in the radtreeviewitem.

how to achieve it.?

Like the below image i need my treeviewitem to display a folder icon and a red square icon in a single treeview item.

enter image description here

like image 427
Dah Sra Avatar asked Jun 14 '16 07:06

Dah Sra


1 Answers

If you do not have data binding and you are using RadTreeViewItems directly you can add the additional image in the Header of the item. For example:

var stackPanel = new StackPanel() { Orientation = System.Windows.Controls.Orientation.Horizontal };
var image1 = new Image() { Source = image1Path };
var image2 = new Image() { Source = image2Path };
var textBlock = new TextBlock() { Text = itemHeader };
stackPanel.Children.Add(image1);
stackPanel.Children.Add(image2);
stackPanel.Children.Add(textBlock);

var treeViewItem = new RadTreeViewItem()
{
    Header = stackPanel,
};

It Works.

like image 194
Dah Sra Avatar answered Oct 06 '22 17:10

Dah Sra