Forum Xamarin.Forms

IconImageSource from FontImageSource

I would like to use IconImageSource from FontImageSource for a Shell enclosed ContentPage's tab with implicit conversion operator, but this way it displays nothing, i have attached a picture to better explain my situation! Thank you!

Answers

  • MommMomm USMember ✭✭✭

    What XF version are you using?

  • MAVZoliMAVZoli Member ✭✭

    @Momm said:
    What XF version are you using?

    4.0.3.908675

  • MommMomm USMember ✭✭✭
    edited October 2019

    Try to update to the latest one, I've solved some issues related to Shell and FileImageSource that got merged in 4.2, so maybe other devs already fixed your issue as well.

    XF.Shell is kind of beta, IMO, so it's good to always use the latest version, because people are working hard to fix all the issues on it.

  • MAVZoliMAVZoli Member ✭✭

    @Momm said:
    Try to update to the latest one, I've solved some issues related to Shell and FileImageSource that got merged in 4.2, so maybe other devs already fixed your issue as well.

    XF.Shell is kind of beta, IMO, so it's good to always use the latest version, because people are working hard to fix all the issues on it.

    I'm sorry, i made a typo, it's 4.3.0.908675

  • JarvanJarvan Member, Xamarin Team Xamurai
    edited October 2019

    I've reproduced your code and faced the same issue. According to this link, setting Color property solved the problem.

    <MenuItem
        Text="Random">
    
        <MenuItem.IconImageSource>
            <FontImageSource FontFamily="materialdesignicons-webfont.ttf#Material Design Icons" Glyph="&#xf884;" Color="Black" />
        </MenuItem.IconImageSource>
    </MenuItem>
    

    Similar issue:
    https://github.com/xamarin/Xamarin.Forms/issues/6559

  • MAVZoliMAVZoli Member ✭✭

    @Jarvan said:
    I've reproduced your code and faced the same issue. According to this link, setting Color property solved the problem.

    <MenuItem
        Text="Random">
    
        <MenuItem.IconImageSource>
            <FontImageSource FontFamily="materialdesignicons-webfont.ttf#Material Design Icons" Glyph="&#xf884;" Color="Black" />
        </MenuItem.IconImageSource>
    </MenuItem>
    

    Similar issue:
    https://github.com/xamarin/Xamarin.Forms/issues/6559

    Unfortunately, it still doesn't work for me :(

  • JarvanJarvan Member, Xamarin Team Xamurai
    edited October 2019

    What's the V:Home? A custom tab? I tested the code on Shell.MenuItem and it works as shown.

  • MAVZoliMAVZoli Member ✭✭

    @Jarvan said:
    What's the V:Home? A custom tab? I tested the code on Shell.MenuItem and it works as shown.

    Thats a simple view, used with implicit conversion operator. Here is the corresponding document: https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/shell/tabs#bottom-tabs

  • JarvanJarvan Member, Xamarin Team Xamurai

    Shell's implicit conversion automatically wraps each ContentPage object in a ShellContent object, which are then both wrapped in a Tab object. You should set icon style for ShellContent instead of a contentPage. Check the code:

    <ShellContent Title="shell_content">
        <ShellContent.Icon>
            <FontImageSource FontFamily="materialdesignicons-webfont.ttf#Material Design Icons" Glyph="&#xf884;" />
        </ShellContent.Icon>
        <views:DogsPage>
        </views:DogsPage>
    </ShellContent>
    
  • MAVZoliMAVZoli Member ✭✭

    @Jarvan said:
    @MAVZoli
    Do you have some update? If the reply solved your issue, please mark the helpful reply as answer. If you are facing some issues while implementing, try to post the particular error with the corresponding codes here.

    sorry for the delay, yes i know what you mean, but the thing is i don't want to use ShellContent tag when there is implicit conversion :/

Sign In or Register to comment.