How do you use a plain image file (such as .png) as the image for a ButtonToolbarItem?

1 Answer 162 Views
Button Toolbar
Stephen
Top achievements
Rank 1
Iron
Iron
Stephen asked on 12 Apr 2023, 11:12 PM

After trying too many unsuccessful things and wasting WAAAAAAY TOO MUCH TIME on something that should be simple, I have come to the realization that either the functionality I need is not documented, documented well, or doesn't exist. I just want to use a .png file as the image source for a ButtonToolbarItem, but the only samples, items in the docs, or Google imply that it can only be done with a FontImageSource. If this is true, I think this constraint was a very poor decision on Telerik's behalf. What if a font doesn't exist for the image I NEED to display on a button?

Help me with this or admit this was a shortsighted decision...

Thanks, Steve Miller

steve@mobynet.io

1 Answer, 1 is accepted

Sort by
1
Didi
Telerik team
answered on 13 Apr 2023, 08:36 AM

Hi Steve,

Thank you for all details provided. 

I have noticed you have logged a bug report for the font usage: https://feedback.telerik.com/maui/1605156-errors-are-being-thrown-unable-to-load-font-telerikfont  and mentioned the .png file visualization in the ButtonToolbarItem. 

I have reviewed the documentation and the information needed is described: https://docs.telerik.com/devtools/maui/controls/toolbar/items/button#net-maui-button-toolbaritem 

The properties for ButtonToolbarItem configuration are Text and ImageSource. Here is the ImageSource description: 

ImageSource(Microsoft.Maui.Controls.ImageSource)—Specifies the source of the image to display in the toolbar item.

You can use a .png file for the ToolbarItem. I have attached the same project as in my reply to the feedback item. 

Here is the result: 

The available.png is displayed in the button toolbar item. I hope this information and the shared project will be of help. Let me know if you have any additional questions. 

Regards,
Didi
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Button Toolbar
Asked by
Stephen
Top achievements
Rank 1
Iron
Iron
Answers by
Didi
Telerik team
Share this question
or