How to get the path where is the silverlight xap file is served

In case you are developing a silverlight application that contains images. You can set the build action of these images to Embedded Resource so as to have them within your XAP file and hence reference them relatively. However, in case you do not want to do so, you can still reference your images easily by setting their passes relative to the current path of the XAP file. The line of code below gets the current path of the running XAP file.


Application.Current.Host.Source

Advertisements