Select to view content in your preferred language

How to set the icon of the button??

808
4
06-07-2011 02:15 PM
DanDong
Deactivated User
Hi everyone,

I want to set different icons for my tool buttons and I have the gif files of all the icons. But when I add Button.Content in xmal to add the image, for some reasons the icon cannot display on the button....I attach a screenshot of the VS xmal page and I want to give the zoomlast.gif image to the first button (now it is blank and the next button is with a capital letter I). In the solution explorer, the zoomlst. gif is already added to the Images folder. I thought maybe that's because it doesn't support gif format? So I change the file to png format. But it still doesn't work....

Can anyone help me out? Really appreciate!
[ATTACH]7217[/ATTACH]
0 Kudos
4 Replies
dotMorten_esri
Esri Notable Contributor
Correct... Silverlight does not support GIF files. They need to be converted to PNG or JPEG.

How are you referencing the files? Ie what path are you using and where are they physically located relative to your solution/projects and output xap file? Are the files located inside the website, or inside the Silverlight project? What is the build action you set on your image files if they are in your silverlight project? All these things matter wrt how you should reference your images.
0 Kudos
DanDong
Deactivated User
Thank you Morten for your tips! I can change those gif files to png format.

These icons are located in D:\AGS_mxd\WIRT\wirt1.0\wirt1.0\Images.
WIRT is the folder that I created.
The first wirt1.0 is the project folder (inside there are wirt1.0 folder, wirt1.0.Web folder and wirt1.0.sln).
The second wirt1.0 is the wirt1.0 folder mentioned above in red color.

So I think they are stored in the project instead of the website. I checked the build action for the icons, it is Resource.

So....do I miss something?...could you guide me more on how to reference those icons? Thank you!
0 Kudos
DanDong
Deactivated User
I add another jpg image to the button, it works. I change the gif file format to png or jpg, the image still cannot show up.

Is this issue also related to the converted file ? or the file size?

info for the gif file: size--165Bytes dimensions --20*20
info for the jpg file: size --7K dimensions --138*160
info for the png file: size --3K dimensions -- 52*92

whatever format I change for the file in red color, it doesn't work
The other two files in black color work well.
0 Kudos
DanDong
Deactivated User
I have fixed the problem. I used another software to convert gif format to png format and the icons work! Thanks!
0 Kudos