Xamarin.Plugins icon indicating copy to clipboard operation
Xamarin.Plugins copied to clipboard

IconToolbarItem/FreshMVVM Dilema

Open jimnorth55 opened this issue 8 years ago • 6 comments

I've been attempting to get IconToolbarItem to play nicely with FreshMVVM.. When run on iOS (Xamarin Forms), I am getting the following exception

Could not initialize an instance of the type 'UIKit.UIImage': the native 'initWithContentsOfFile:' method returned nil.

It appears the instance of IconToolbarItem is interpreting the Icon property ("fa-refresh" in this case) as a file name. I'm fairly certain that this issue is caused by the fact that FreshMVVM is internally creating and utilizing NavagationPage pages instead of IconNavigationPage. All of the other Iconize views are working normally, so it is not a configuration issue.

While this is not strictly an issue with IconToolbarItem, it is a nasty roadblock preventing one from using these two superb libraries together. I'm hoping the contributors here, have a suggestion for how I might best proceed with getting this to work.

jimnorth55 avatar Jul 12 '16 19:07 jimnorth55

I'm having the same problem. My work around on android was to create:

public class MyNavigationContainer : IconNavigationPage, IFreshNavigationService { // copy everything from FreshNavigationContainer }

But this still gives the same error on IOS as you're getting.

paul-kiar avatar Aug 30 '16 20:08 paul-kiar

I believe the problem is the fact that the Icon property is used for holding the name of the character to render, this is not a valid resource image name so Mono is throwing an exception.

paul-kiar avatar Aug 31 '16 13:08 paul-kiar

I have confirmed that the Icon property on IconToolbarItem should not be used as the holder for the Icon, if you set the Icon to say fa-barcode and then create images fa-barcode.png the fa-barcode.png is rendered as the IconToolbarItem icon, not the fa-barcode character from fontawesome.

I thought maybe I could work around the problem by putting in stub images, hoping that the Icon would switch on load, but no, it always displays the stub image.

paul-kiar avatar Aug 31 '16 14:08 paul-kiar

I have same problem and noticed that the IsVisibleProperty binding not work too.

jzhouw avatar Sep 01 '16 05:09 jzhouw

I'm with this problem too, there any news?

candidodmv avatar Aug 17 '17 12:08 candidodmv

I found ~~the solution~~ workaround

candidodmv avatar Aug 30 '17 15:08 candidodmv