Paints an area with an image.
To create an object using scripting, see CreateFromXAML.
PNG Color Depth
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.
<!-- 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