Iconize icon indicating copy to clipboard operation
Iconize copied to clipboard

Iconize to set the Icon of Master/MasterDetailPage

Open Schinwinkwinsky opened this issue 6 years ago • 4 comments

Is it possible to set the Icon of MasterPage of a MasterDetailPage? As I tried bellow it's not working, even on Android and on iOS.

captura de tela 2018-12-19 as 13 46 41

Schinwinkwinsky avatar Dec 19 '18 16:12 Schinwinkwinsky

The ContentPage.Icon property is of type Xamarin.Forms.ImageSource, so it cannot be assigned a Plugin.Iconize.IconImage. Instead, you need to assign it an instance of a class that derives from ImageSource.

This seems like a widespread problem that is in need of a solution, since it occurs in many places in Xamarin.Forms. For example, I am currently experimenting with Xamarin.Forms.Shell (currently in the preview of Xamarin.Forms v4.0), which contains ShellItem members that each have an Icon property of type ImageSource.

It would be great if Iconize could offer its own implementation of ImageSource that could be used in all these (currently unsupported) scenarios. I have spent some time looking at the source code of Xamarin.Forms and Iconize, hoping to discover how this might be achieved, but without success. I can see that an ImageSource can be created from a stream, but it is not obvious how to derive a stream from the rendering of an icon, especially since each platform has its own very distinct way of rendering icons.

@jsmarcus: Can you advise on the correct approach (and perhaps point me to a similar implementation that demonstrates the required technique). I will be happy to create a prototype IconImageSource and submit a pull request.

aquisio avatar Dec 26 '18 09:12 aquisio

I believe when xamarin/Xamarin.Forms#4747 gets merged we will be able to provide an Iconize friendly implementation.

jsmarcus avatar Dec 27 '18 16:12 jsmarcus

I am currently in the process of evaluating Iconize for a project I am working on and found out that I cannot use icon fonts in every place… I stumbled across this issue and then found out about [https://github.com/xamarin/Xamarin.Forms/pull/4747].

Does anyone happen to know whether there is a sample on how to make use of FontImageSource in 3.6 Preview?

Mephisztoe avatar Feb 16 '19 20:02 Mephisztoe

Any updates on this? https://github.com/xamarin/Xamarin.Forms/pull/4747 was merged.

garyng avatar Jul 25 '19 03:07 garyng