Silverlight / WPF - Append an image to the button content - programmatically

Asked By rohini on 30-Mar-10 07:41 AM
I have an issue with appending an image to a programmatically created button. I tried using the following
textbutton.Content = new ImageBrush { ImageSource = new BitmapImage(new Uri("Picasso.jpg", UriKind.Relative)), Stretch = Stretch.Fill };
But it is not working. It is just showing System.Windows.Image and not the image.

Please help to resolve this issue.

Super Man replied to rohini on 30-Mar-10 08:34 AM

            Button b1 = new Button();



            ImageList i1 = new ImageList();



            b1.ImageList = i1;

            b1.ImageIndex = 0;

Goniey N (Mr. G) replied to rohini on 30-Mar-10 08:46 AM
//Write This Into Your.xaml File In WPF

<Button Margin="73,85,70,104" Name="Button1">Button</Button>
<Image Margin="73,85,70,104" Name="Image1" Stretch="Fill" Source="file:///C:/Documents and Settings/Nayak Jigneshkumar J/Desktop/Gcet 2009/My Mobile Data/Images/Extra/Admirable.jpg" />