Reputation: 311
In xamarin forms using icon as png file is very painfull with all the sizeand native stuff that you need to do and verify. I decide to use font awesome but this way i can't put in toolbar item and neither in some button tha need a text too. Do anyone has a guide to use as fileimagesource because the fontimagesource is not compatible to use in place of fileimagesource. Or, anyone has a guide to do presseffect with some code that i can use in all my stuff?
This is not possible
<ContentPage.ToolbarItems>
<ToolbarItem>
<ToolbarItem.Icon>
<FontImageSource/>
</ToolbarItem.Icon>
</ToolbarItem>
</ContentPage.ToolbarItems>
this is the way it works
<ContentPage.ToolbarItems>
<ToolbarItem>
<ToolbarItem.Icon>
<FileImageSource/>
</ToolbarItem.Icon>
</ToolbarItem>
</ContentPage.ToolbarItems>
I expect to use the press effect without plugin, using a easy render maybe, or at least i want to use fonticon in toolber item like a normal image or text.
Obs: Text of toolbar item dosen't have fontfamily, if there's a way to do this with converter I will be grateful.
Upvotes: 5
Views: 5065
Reputation: 311
Now with Xamarin 4.0 new release, this it's possible. The follow code works just fine:
<Button Text="Pesquisar">
<Button.ImageSource>
<FontImageSource Glyph="" FontFamily="{StaticResource FontIcon}"/>
</Button.ImageSource>
</Button>
And this too:
<ContentPage.ToolbarItems>
<ToolbarItem>
<ToolbarItem.IconImageSource>
<FontImageSource Glyph="" FontFamily="{StaticResource FontIcon}"/>
</ToolbarItem.IconImageSource>
</ToolbarItem>
</ContentPage.ToolbarItems>
Upvotes: 9