My Master's Thesis Problems and solutions encountered…

8May/100

Adding Images

Here is just a quick guide to inserting images into your Silverlight application, and how to make them link to other pages. In this example I will just hardcode the name of the image, but I will soon write another post about how to insert images dynamically.

First, you need to create an images folder. If the name of your application is MyApp, go to the ClientBin folder located at MyApp >> MyApp.Web >> ClientBin, and create the images folder.

The following simple code snippet shows how you insert an image located in your images folder.


<Image Source="../images/picture.jpg" Height="100" />

If you want your image to link to another Silverlight page, you simply create the image as an HypelinkButton:


<HyperlinkButton HorizontalAlignment="Center" NavigateUri="/mypage.xaml">
        <HyperlinkButton.Content>
              <Image Source="../images/picture.jpg" Height="100" />
        </HyperlinkButton.Content>
</HyperlinkButton>

Oh, and remember that Silverlight only supports .png and .jpg images.

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


four × = 24

No trackbacks yet.