Skip to content

Latest commit

 

History

History
42 lines (29 loc) · 1.19 KB

File metadata and controls

42 lines (29 loc) · 1.19 KB

Icon

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"

Thanks to the Icon control, you are able to display a tinted image:

<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 BitmapIcon and FontIcon controls. 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