Tuesday, September 7, 2010

Adding an ImageBrush in Silverlight

Using an ImageBrush in Silverlight Application


ImageBrush elements are similar to the SolidColorBrush. Instead of a solid color, they define an image that is applied as a brush. You can apply them to the properties of Silverlight controls the same way that the SolidColorBrush is applied.

To apply an ImageBrush to a Silverlight control, you need to define the ImageBrush element and set the ImageSource property to an image that has been added to the project. You will likely want to set the Stretch property so that the image appears appropriately in the control.

Eg:

< TextBox Height="200" Width="150" >
< TextBox.Background >
< ImageBrush ImageSource="jobin.jpg"/ >
< /TextBox.Background >
< /TextBox >

No comments: