Now I want to change the icon without using another...">

WPF Background Image Sprites Image

In WPF image management,

< Image Source="icon.png" /> 

Now I want to change the icon without using another image like icon1.png, Is there a way to set the background position, for example, in css? So that I can store several icon images in icon.png and show what is required, and then have several images in the form of icon1.png, icon2.png.

Any help?

thanks

+4
source share
1 answer
 <Image> <Image.Source> <CroppedBitmap Source="<some path>" SourceRect="X,Y,W,H" /> </Image.Source> </Image> 

A small example. For more information, you can see MSDN .

+3
source

Source: https://habr.com/ru/post/1489993/


All Articles