views:

702

answers:

1

I am trying to generate an image in silverlight but for some reason it is not showing.

Here is the code that I am using

             Image fireBall = new Image();
            Uri imageUri = new Uri("/Yambushi;Images/Projectiles/Fireball.png", UriKind.Relative);
            fireBall.Source = new BitmapImage(imageUri);
            cnvGame.Children.Add(fireBall);
            fireBall.SetValue(Canvas.LeftProperty, Convert.ToDouble(100)); //(Doll left property)
            fireBall.SetValue(Canvas.TopProperty, Convert.ToDouble(100));
            fireBall.Height = 30;
            fireBall.Width = 30;

Yambushi being the solution name and cnvGame the canvas I want to display the image in. The png file build action is set to content

A: 

Ok solved the problem...after I debugged the sourceUri of an image i've implemented through xaml and the source had to be as follows:

 Uri imageUri = new Uri("/Images/Projectiles/Fireball.png", UriKind.Relative);
            fireBall.Source = new BitmapImage(imageUri);
Drahcir