Mega Code Archive

 
Categories / VB.Net / WPF
 

Fill a Shape with an Image

<Window x:Class="WpfApplication1.Window1"     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     Title="WPF" Height="300" Width="300">     <Canvas Margin="5">         <!--Define a static ImageBrush resource-->         <Canvas.Resources>             <ImageBrush x:Key="IB1" ImageSource="c:\image.jpg" />         </Canvas.Resources>         <!--Fill ellipse using static ImageBrush resource-->         <Ellipse Height="160" Width="160"  Canvas.Top="0" Canvas.Left="110"                   Stroke="Black" StrokeThickness="1"                   Fill="{StaticResource IB1}" />     </Canvas> </Window>