Thanks to the Icon
control, you are able to display a tinted image. In order to use this control, you need to call the UseSimpleToolkit()
extension method in your MauiProgram.cs
file:
builder.UseSimpleToolkit();
Icon
can be found in the following XAML namespace:
xmlns:simpleCore="clr-namespace:SimpleToolkit.Core;assembly=SimpleToolkit.Core"
If no tint color is defined, black color is used:
<simpleCore:Icon Source="star.png"/>
<simpleCore:Icon Source="star.png" TintColor="Gray"/>
<simpleCore:Icon Source="star.png" TintColor="Orange"/>
Output:
The Icon
class is inherited from the .NET MAUI Image
class, but behind the scenes it is implemented in the same way as .NET MAUI Image
only on Android and iOS. WinUI implementation is based on IconSourceElement
. Because of that, the control supports only these image sources on Windows:
FileImageSource
UriImageSource
FontImageSource
These Image
properties are not supported at all:
Aspect
- the default behavior isAspectFit
IsAnimationPlaying
IsLoading
IsOpaque