Fill Rectangles with static ImageBrush resources
<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="380">
<StackPanel Orientation="Horizontal">
<Canvas Margin="5">
<Canvas.Resources>
<ImageBrush x:Key="IB1" ImageSource="c:\image.jpg"
Stretch="UniformToFill" TileMode="FlipXY"
Viewport="0,0,0.2,0.2" />
</Canvas.Resources>
<Rectangle Canvas.Top="5" Canvas.Left="5"
Height="180" Width="80"
Fill="{StaticResource IB1}" />
</Canvas>
</StackPanel>
</Window>
Related examples in the same category