Skip to content

Latest commit

 

History

History
44 lines (30 loc) · 1.24 KB

File metadata and controls

44 lines (30 loc) · 1.24 KB

Icon

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"

Example

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:

Implementation details

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 is AspectFit
  • IsAnimationPlaying
  • IsLoading
  • IsOpaque