Mega Code Archive

 
Categories / VB.Net Tutorial / WPF
 

Using a DrawingBrush resource to draw Rectangle

<Window x: Class="WpfApplication1.Window1"     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     Title="ResourcesExample" Height="300" Width="300"     >      <Window.Resources>     <GeometryDrawing x:Key="drawing" Brush="Green">       <GeometryDrawing.Geometry>         <EllipseGeometry RadiusX="200" RadiusY="10" />       </GeometryDrawing.Geometry>     </GeometryDrawing>     <DrawingBrush x:Key="dbrush" Drawing="{StaticResource drawing}" />   </Window.Resources>   <StackPanel Orientation="Vertical">     <Rectangle Width="250" Height="50" Fill="{StaticResource dbrush}" />   </StackPanel> </Window>