Mega Code Archive

 
Categories / VB.Net / WPF
 

Using a Drawing resource

<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>   </Window.Resources>   <StackPanel Orientation="Vertical">     <Rectangle Width="250" Height="50">       <Rectangle.Fill>         <DrawingBrush Drawing="{StaticResource drawing}" />       </Rectangle.Fill>     </Rectangle>   </StackPanel> </Window>