Can XAML be used to copy areas of other images?
I'm looking to us开发者_高级运维e xaml as a way to access spritesheet.
Is xaml capable of referencing a png file and displaying just a portion of that file?
You should be able to use the following (where you change the composite transform attributes for the sprite offset):
<Rectangle x:Name="R" Width="20" Height="20" >
<Rectangle.Fill>
<ImageBrush ImageSource="Spritesheet.png" Stretch="None" AlignmentX="Left" AlignmentY="Top" >
<ImageBrush.Transform>
<CompositeTransform TranslateX="-20" TranslateY="-20"/>
</ImageBrush.Transform>
</ImageBrush>
</Rectangle.Fill>
</Rectangle>
精彩评论