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

referencing image in different xap

3 Answers 57 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
paul
Top achievements
Rank 1
paul asked on 22 Jul 2011, 07:04 PM
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)

3 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 27 Jul 2011, 04:27 PM
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. 

Regards,
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!

0
paul
Top achievements
Rank 1
answered on 29 Jul 2011, 07:22 PM
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
0
Tina Stancheva
Telerik team
answered on 04 Aug 2011, 10:04 AM
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 >>

Tags
TreeView
Asked by
paul
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
paul
Top achievements
Rank 1
Tina Stancheva
Telerik team
Share this question
or