VisualBrush is used to fill UI elements. The following code uses a
VisualBrush to fill a rectangle. We can define a simple or complex UI element and assign it to the
VisualBrush.Visual property using
VisualBrush. We can then use the VisualBrush to create interesting effects, such as reflection and magnification.
How to Use
This example shows how to use the VisualBrush class with a Visual. Here, I am using media element as visual. A
Visual object usually hosts one container panel such as a
StackPanel and on this container.
Here is the XAML code:
Title="MainWindow" Height="350" Width="525">
<Ellipse Height="100" Width="100" Name="elipsemedia" >
Here, I used
Ellipse.fill property for video brush. This
fill property sets the
Brush that specifies how the shape's interior is painted.
- 27th June, 2013: Initial post
This tip is based on http://articlesforprogramming.blogspot.in/2013/06/visual-brush-in-wpf.html.