Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

Creating button from code behind?

$
0
0

I am working on xamarin forms. Where I am creating Button from code behind. When I specify WidthRequest and HeightRequest for the button, the button text is not showing and If I remove WidthRequest and HeightRequest then the button text is showing.

Code for creating button

    Button buttonRemoveItem = new Button()
    {
        Text = "-", 
        TextColor = Color.White,
        WidthRequest = 25,
        HeightRequest = 25,
        CornerRadius = 10,
        BackgroundColor = Color.Red
    };

output

If I remove WidthRequest and HeightRequest
then my code looks like

 Button buttonRemoveItem = new Button()
    {
        Text = "-",
        TextColor = Color.White,    
        BackgroundColor = Color.Red
    };

and the output

How to resolve this?


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>