I'm creating a deployable module where some parts are written in Silverlight, and I'm making the SL application deployable for OOB usage. However, I want to make Silverlight take the name of the website that it's deployed from, such as, when a user installs it from Example.com, I want to have "example.com application" with the site's own icon in the shortcut. Is there any "supported" method of doing this, or will I be going with locating the XAP file and manually changing AppManifest.xaml
inside it?
Asked
Active
Viewed 568 times
0

Can Poyrazoğlu
- 33,241
- 48
- 191
- 389
1 Answers
1
You will need to find out your URL of your application:
string appURL = Application.Current.Host.Source.AbsoluteUri.Substring(0, Application.Current.Host.Source.AbsoluteUri.IndexOf(@"ClientBin/"));
So this will solve the title problem, next is the icon. You could load the image from the page:
Uri uri = new Uri(String.Format("{0}/favicon.png", appURL));
IconImage.Source = new BitmapImage(uri);
It's not perfect, you will have to manipulate appURL
to get the domain name only.

Rumplin
- 2,703
- 21
- 45
-
I was talking about the icon on desktop/start menu when you install the app. Will this be effective for that? – Can Poyrazoğlu Aug 25 '11 at 01:14
-
when you first start your app, you start it from web and then install it to the desktop or am I wrong? – Rumplin Aug 25 '11 at 20:59
-
yes, but will this code work for installing on desktop? it doesn't/cannot alter the original XAP file anyway. – Can Poyrazoğlu Aug 25 '11 at 21:29
-
hmm, XAP is a zip file, try to change it's content somehow from the webpage before serving it. – Rumplin Aug 25 '11 at 21:51
-
yes, that's exactly what I'll be doing, but I was wondering if there was a non hacky better way. – Can Poyrazoğlu Aug 26 '11 at 12:52