And to answer your initial question about images in buttons, here's how to do 
it:

from System.Windows.Controls import Button, Image
from System.Windows.Media.Imaging import BitmapImage

btn = Button(
    Width = 25, 
    Height = 20,
    Content = Image(
        Source = BitmapImage(Uri("images/stop.jpg", UriKind.Relative))
    )
)

This assumes that "images/stop.jpg" is relative to the XAP file of your 
application. To add an image to a System.Windows.Controls.Button, you must use 
System.Windows.Controls.Image. The Image control then lets you set its Source, 
which is where System.Windows.Media.Imaging.BitmapImage comes into play. 
Confusing, I know =(

This syntax uses IronPython's ability to use Python's named parameters to set 
properties; it makes working with Silverlight and WPF objects a lot less 
painful. Not using named parameters would look like this:

btn = Button()
btn.Width = 25
btn.Height = 20
img = Image()
img.Source = BitmapImage(Uri("images/stop.jpg", UriKind.Relative))
btn.Content = img

Oy =P

Let me know if you have any other Silverlight questions,
~Jimmy
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to