15.02.2015 Views

C# 4 and .NET 4

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Brushes ❘ 993<br />

imagebrush<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

To load an image into a brush, you can use the ImageBrush element. With this element, the image defined<br />

by the ImageSource property is displayed. The image can be accessed from the file system or from a<br />

resource within the assembly. In the example, the image is added as a resource to the assembly <strong>and</strong><br />

referenced with the assembly <strong>and</strong> resource names:<br />

Visualbrush<br />

<br />

<br />

<br />

<br />

<br />

The VisualBrush allows you to use other WPF elements in a brush. Here, you can add a WPF element to<br />

the Visual property. The sixth element in Figure 35-8 contains a Rectangle <strong>and</strong> a Button:<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

You can add any UIElement to the VisualBrush. One example is that you can play a video by using the<br />

MediaElement:<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

www.it-ebooks.info

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!