referencing image in different xap

4 posts, 0 answers
  1. paul
    paul avatar
    3 posts
    Member since:
    Jul 2011

    Posted 22 Jul 2011 Link to this post

    I need to set DefaultImageSrc of a tree item (and other things that support images) to reference an icon in a different xap. THe xap is loaded into my app. (xap1 has the UI, xap 2 has the data model indicating data to be shown by the UI)
  2. Petar Mladenov
    Petar Mladenov avatar
    2882 posts

    Posted 27 Jul 2011 Link to this post

    Hello Paul,

     Could you please elaborate more on your scenario so that we would be better able to assist you? Meanwhile please check out this blog post and let us know if it helps you somehow . Thank you for your cooperation. 

    Petar Mladenov
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  3. DevCraft banner
  4. paul
    paul avatar
    3 posts
    Member since:
    Jul 2011

    Posted 29 Jul 2011 Link to this post

    My app successfully loads multiple xaps

    THe UI is managed in xap1 (all calls to telerik code are there)

    The other xaps provide data for the UI to work on (they know how to fetch the data, format it etc).

    I want the data xaps to be able to provide icons for the objects they manage and hand off to the UI layer. Concrete example. I want the RadTreeItems to have data specific icons. The icon is a part of the data xap that provides the data objects. I dont see how to refer to them

    I must go

    var it = new RadTreeItem();
    it.DefaultImgSrc = "...some string...";

    What is the correct syntax of this string that would allow me to refer to an icon in a xap that is not the one that contains this code
  5. Tina Stancheva
    Tina Stancheva avatar
    3298 posts

    Posted 04 Aug 2011 Link to this post

    Hi Paul,

    You can use the approach that is demonstrated in the blog post Peter reffed you to. Basically you can access the stream of the image from the second xap and use it to create a BitmapImage. Then you can set the RadTreeViewItem.DefaultImageSource to the BitmapImage.

    I attached a sample project demonstrating this approach. Please make sure that the SilverlightApplication8.Web project is marked as start-up project and the SilverlightApplication8TestPage.aspx page is the start-up page.

    Examine the solution and let us know if it helps.

    Kind regards,
    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Back to Top