ImageSource in C#? #90
-
Is it possible to use MauiIcons as an imageSource, in a swipeView or A ShellContent Icon? I can't seem to figure out how to do this in C#. I can see it's possible to use MauiIcons as an image source in XAML, but I can't figure out how convert that into C#. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
Of course, we can use MauiIcons as image source or fontimage source, but can you provide a sample of your use case. Therefore I can provide you a optimal way of making the mauiicons as image source |
Beta Was this translation helpful? Give feedback.
-
Oh wow that was fast...um.... I've got a ShellContent view, built into Maui, which has an Icon property which expects an ImageSource, and the SwipeItem class which has an IconImageSource property, expecting an ImageSource, and I don't know how to get the ImageSource out of a MauiIcon:
|
Beta Was this translation helpful? Give feedback.
-
@eamonnalphin I have release v2.1.5 of MauiIcons which Contains new Extension for your Use Case, As you can see in the Below Code, I Have Used MauiIcons.Material Module to Demonstrate the New Extension, You can use this extension on All of MauiIcons Modules using MauiIcons.Core;
using MauiIcons.Material;
public class LogView : ShellContent
{
public LogView()
{
Title = "Log";
Icon = MaterialIcons.Favorite.ToImageSource();
var swipeItem = new SwipeItem {
IconImageSource= MaterialIcons.Favorite.ToImageSource();
};
var mySwipeView = new SwipeView();
mySwipeView.RightItems = new SwipeItems{swipeItem};
}
} |
Beta Was this translation helpful? Give feedback.
-
I'll mark this answered and close this discussion, feel free to comment on this if you have any questions |
Beta Was this translation helpful? Give feedback.
@eamonnalphin I have release v2.1.5 of MauiIcons which Contains new Extension for your Use Case, As you can see in the Below Code, I Have Used MauiIcons.Material Module to Demonstrate the New Extension, You can use this extension on All of MauiIcons Modules