MWFBrad
MWFBrad

Reputation: 30

How do I create a Xamarin button with text AND a background image

From what I've read, a plain Xamarin button allows text but no background image. A Xamarin ImageButton allows for an image, but no text. So how can I get both without shelling out for a SyncFusion licence?

Upvotes: 0

Views: 2256

Answers (1)

user13995305
user13995305

Reputation:

You can use grid to put text on ImageButton. You need to put Label and button same row.

<Grid HorizontalOptions="Center"
  VerticalOptions="Center">
    <Grid.RowDefinitions>
        <RowDefinition Height="*" />
    </Grid.RowDefinitions>
    <ImageButton HorizontalOptions="Center" VerticalOptions="Center"
        Source="Xamarin_logo.jpg"
                 Grid.Row="0"/>
      <Label HorizontalOptions="Center" VerticalOptions="Center"
     Text="button"
     TextColor="Purple"
             FontSize="Large"
     Grid.Row="0"/>
</Grid>

Upvotes: 2

Related Questions