ImageBrush Object
Paints an area with an image.
XAML |
<ImageBrush .../>
|
Scripting |
To create an object using scripting, see CreateFromXAML.
|
AlignmentX, AlignmentY, DownloadProgress, ImageSource, Name, Opacity, RelativeTransform, Stretch, Transform
Equals, FindName, GetHost, GetValue, SetSource, SetValue
An ImageBrush can be used to create a decorative effect for text in your application. For example, the Foreground property of the TextBlock can specify an ImageBrush.
If the ImageSource property is set to an invalid format, or is specified to a URI that cannot be resolved, then the ImageFailed event is raised.
Silverlight 1.0 does not support all possible color depths that are included in the PNG specification. The following are the PNG color depths supported in Silverlight 1.0.:
- Indexed color: 1, 4, or 8 bit color depth (per channel).
- Truecolor: 24 bit color depth, or 32 bit color depth (per channel) for truecolor plus alpha.
Notably, gray scale (with or without alpha), and 64-bit truecolor, are not supported in Silverlight 1.0.
The following XAML example shows how to set the Foreground property to an ImageBrush, whose image is used as the fill for the TextBlock's rendered text.
XAML |
---|
<!-- TextBlock with an image brush applied to the text. --> <TextBlock Canvas.Top="120" FontFamily="Verdana" FontSize="72" FontStyle="Italic" FontWeight="Bold"> SHRUBBERY <TextBlock.Foreground> <ImageBrush ImageSource="forest.jpg"/> </TextBlock.Foreground> </TextBlock> |
The following screenshot shows the results of the previous XAML example.
An image file used by Image and ImageBrush objects