0
votes

I'm new in xaml, and I have an issue. I'm trying to create a button with an icon next to my text in xamarin.forms. But when I'm trying to display it, I have nothing on my app. To add the png icon. The image is located in the Ressources->drawable folder. Here's the xaml code.

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"
             x:Class="epicture.MainPage">

    <StackLayout>
        <Button Text="Log in" ImageSource="login.png" Clicked="Button_Clicked" HorizontalOptions="Center" VerticalOptions="CenterAndExpand" BackgroundColor="#00c851" TextColor="White"></Button>
        <WebView Navigating="WebView_Navigating"></WebView>
    </StackLayout>
</ContentPage>
1
use image button - logeshpalani31
@logeshpalani98 it's an icon with a text next to it, ImageButton doesn't have a Text attribute isn't it ? - Thomas_Vcheck

1 Answers

1
votes

I also face same issue ImageButton not have text property. Because of that I created Custom ImageButton Control With Text Property you can refer this might be it will help you.

https://xamarincodingtutorial.blogspot.com/2019/05/step-to-create-imagebutton-with-text.html