You could use a CroppedBitmap
as the Source
of your image. For example to cut out the second image in the third row (at x=32, y=64) you would write:
<Image Height="32" Width="32">
<Image.Source>
<CroppedBitmap Source="{StaticResource SpriteImage}"
SourceRect="32,64,32,32"/>
</Image.Source>
</Image>
Or use a Rectangle with an ImageBrush
instead of an Image
control, where you could set the Viewbox
:
<Rectangle Height="32" Width="32">
<Rectangle.Fill>
<ImageBrush ImageSource="{StaticResource SpriteImage}"
ViewboxUnits="Absolute" Viewbox="32,64,32,32"/>
</Rectangle.Fill>
</Rectangle>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…