Question

I created a custom user control which contains an <Image /> control. My user control is bound to a CLR object which contains the proper filename to use for the <Image> Source property.

The user control is located under Controls folder in my Silverlight app. When the app runs, the image is only displayed if the image is in the same folder as the user control (i.e. the image must in the Controls folder).

How can I make the image source be relative to the location the Silverlight app is running?

The app is hosted in an ASP.NET MVC application.

Was it helpful?

Solution

A relative path that starts with "/" is considered be routed at the top level of the XAP file and (if the resource is not found in the Xap) in the server folder from which the XAP was downloaded.

In other words place a "/" at the beginning or your Urls and you will probably get the behaviour you describe.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top