Share via


ImageBrush

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Paints an area with an image.

<ImageBrush   .../>

Managed Equivalent

ImageBrush

Remarks

You can use an ImageBrush object to create a decorative effect for text in your application. For example, the Foreground property of a TextBlock object can specify an ImageBrush.

If the ImageSource property is set to an invalid format, or it specifies a URI that cannot be resolved, the ImageFailed event is raised.

Example

The following XAML example shows how to set the Foreground property to an ImageBrush object, the image of which is used as the fill for the TextBlock objects 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>

See Also

Reference