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

TreeviewItem DefaultImgSrc

1 Answer 60 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
SWAYAM KAR
Top achievements
Rank 1
SWAYAM KAR asked on 24 Mar 2010, 07:18 PM
Is it possibble to set the DefaultImgSrc of a treeview item to a System.Windows,Controls.Image type? Basically I want to do the following.

 

RadTreeViewItem node = new RadTreeViewItem();

 

 

Image iconImage = new Image();

 

 

BitmapImage img = new BitmapImage(new Uri(uriString, UriKind.Relative));

 

iconImage.Source = img;

 

 

ToolTipService.SetToolTip(iconImage,"Test tooltip");

 

node.DefaultImageSrc = img;

Thanks,
Swayam

1 Answer, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 30 Mar 2010, 09:17 AM
Hi SWAYAM KAR,

You cannot set the DefaultImageSrc to System.Windows.Controls Image class since it represents a control that displays an image.

Unfortunately, there is also a known bug in the RadTreeView control and for now the DefaultImageSrc cannot be set to an object of type BitmapImage. We are currently working on this issue and we will do our best to fix it as soon as possible.

However, for now you can either try this from code-behind:
string uriString = "icon.png";
node.DefaultImageSrc = uriString;

or you can take a look at the example I attached and follow the suggested approach in it.

Please let me know if either of this suggestions work for you.

If not, can you please elaborate on the scenario you want to implement, so that we can suggest the best suited approach for you.

Greetings,
Tina Stancheva
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
TreeView
Asked by
SWAYAM KAR
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Share this question
or