<Rectangle x:Name="RectangleName"
StrokeThickness="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Width="200"
Height="300"
Stroke="Black" >
<Rectangle.Fill>
<ImageBrush ImageSource="{Binding SelectedComponentsImage}" x:Name="ComponentVisualBrush" ViewboxUnits="Absolute"
Viewbox="0,0,300,300" ViewportUnits="RelativeToBoundingBox" Stretch="UniformToFill" Viewport="0,0,1,1"
RenderOptions.EdgeMode="Aliased" />
</Rectangle.Fill>
</Rectangle>
This is tied to the viewmodel. You can replace the snap with uri image.
source
share