MauiIcons
MauiIcons copied to clipboard
Add feature to MauiIcons to return Font Icons as strings
Hey
Thanks for providing this component for MAIU - have found it quite useful so far.
Just a feature request to make it even more useful - would be great to have an easy way to use this to feed the Icons (and font family) back as string (character codes) so we can assign them to Text/Content properties of various controls such as buttons/labels and other places.
One scenario this would be particularly useful for buttons right now given the MAIU ImageButton/Button rendering of the image is pretty flakey and formatting options very limited (whereas with the text we at least get some nice controls over alignment and padding). Would also be great for many other controls too.
For example - have something like this :
<Button .... FontFamily="{SomeStaticResource pointing to font in your component}"> <Button.Text> <mauIcons:Text Icon="Info"/> <-- (This would simply return back the Unicode character for the specified icon). </Button.Text> < /Button>
I'm normally doing this right now by having my own FontFamily StaticResources in the App.xaml along with some staticresource with the hex codes for the characters. This of course means I need to include the font in the manifest and reference it in the MauiProgram.cs. However, would be great to have that simplicity in example above & not have to duplicate up the importing of the Icon font.
Also similar to this - support this sort of thing in code behind too (ie. return string via some extension method so we can use the enum to resolve what icon we want) - as I sometimes will be building up arrays of buttons/contents via code and want to be able to assign values to string properties too.
If your component already does this and I missed it apologies - couldn't find anything other than examples/controls/extensions for bringing back Icons as images.
cheers Niall