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

How to define Icon by code.

3 Answers 65 Views
OutlookBar
This is a migrated thread and some comments may be shown as answers.
Joe
Top achievements
Rank 1
Joe asked on 13 Oct 2009, 05:32 PM
I tried this without sucess, icon should be wich type?

string header = "Header";  
Image icon = null;  
RadOutlookBarItem robi = new RadOutlookBarItem();  
robi.Header = header ;  
if (icon != null)  
{  
     robi.Icon= icon.Source;  
}  
 




3 Answers, 1 is accepted

Sort by
0
Kiril Stanoev
Telerik team
answered on 14 Oct 2009, 12:26 PM
Hello Joe,

The Icon property can be set like this:

robi.Icon= new BitmapImage(new Uri("someImage.png"));

I have attached a sample project demonstrating the above functionality. Let me know if you have additional questions.

Best wishes,
Kiril Stanoev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Joe
Top achievements
Rank 1
answered on 15 Oct 2009, 09:51 AM

Thank u.

The example works well, but i'm using a collection of an object and amazingly when i try to define the icon the program gives me a stack Overflow error.


foreach (var item in mycollection)  
 {  
 
    RadOutlookBarItem bar = new RadOutlookBarItem();  
 
    bar.Icon = item.icon; // ERROR  
 
 } 
0
Kiril Stanoev
Telerik team
answered on 16 Oct 2009, 06:50 AM
Hello Joe,

I was not able to reproduce the issue. Of what type is your collection? Also, it would be great if you could provide me with a sample project demonstrating the problem.

All the best,
Kiril Stanoev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
OutlookBar
Asked by
Joe
Top achievements
Rank 1
Answers by
Kiril Stanoev
Telerik team
Joe
Top achievements
Rank 1
Share this question
or