How to define Icon by code.

4 posts, 0 answers
  1. Joe
    Joe avatar
    15 posts
    Member since:
    May 2009

    Posted 13 Oct 2009 Link to this post

    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;  
    }  
     




  2. Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1512 posts

    Posted 14 Oct 2009 Link to this post

    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.
  3. DevCraft banner
  4. Joe
    Joe avatar
    15 posts
    Member since:
    May 2009

    Posted 15 Oct 2009 Link to this post

    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  
     
     } 
  5. Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1512 posts

    Posted 16 Oct 2009 Link to this post

    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.
Back to Top