Mystogan
Mystogan

Reputation: 577

Xamarin forms button with both text and vector image on iOS

In my Xamarin.Forms PCL project, I'm trying to create a button with a text shown below an image. But as soon as I add the image (which is a Vector image - and no way of specifying size?) - the text disappears. Only the image is displayed.

Any ideas on why the text is disappearing when the image is shown?

My code:

<?xml version="1.0" encoding="UTF-8"?>
<Button xmlns="http://xamarin.com/schemas/2014/forms" 
        xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
        x:Class="MyProj.Views.ToolbarButtonView"
        Text="hello" 
        Image="myvectorimage" 
        ContentLayout="Top,1" >
</Button>

I appreciate the help!

Upvotes: 0

Views: 276

Answers (1)

ColeX
ColeX

Reputation: 14475

Here(Kevin) is a better answer to explain the image and text on Button.

I think it is better to use a StackLayout(adding TapGesture) with Image and Label instead of Button. It is more controllable.

Upvotes: 1

Related Questions