[IronPython] Can't Get an Image on a Button Ipy Silverlight

Jimmy Schementi Jimmy.Schementi at microsoft.com
Tue Jan 5 22:10:08 CET 2010

I think BitmapImage is what you're looking for:

from System import Uri, UriKind
from System.Windows.Controls import Button
from System.Windows.Media.Imaging import BitmapImage

stopB = Button()
stopB.Content = BitmapImage(Uri("images/stop.jpg", UriKind.Relative))


From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Andrew Evans
Sent: Tuesday, January 05, 2010 12:44 PM
To: users at lists.ironpython.com
Subject: [IronPython] Can't Get an Image on a Button Ipy Silverlight

I have been trying for two days now and can't seem to get it right. It doesn't help that Silverlight returns no errors

Can any one help me figure out how to use an image as a Button in Silverlight

some code I have tried

        self.stopB = Button() # stop button
        imageSource = Uri("images/stop.jpg", UriKind.Relative)
        stopImage = Image()
        stopImage.Source = imageSource
        self.stopB.Content = stopImage


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20100105/fec275be/attachment.html>

More information about the Ironpython-users mailing list