Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to have transparent background for button?

Tags:

xaml

uwp

uwp-xaml

I am develop na UWP app, and I would like to have a transparent button. I try this (Is a simple example of my button):

<Button Name="Button"
        Opacity="0">
        <Image Source="/Assets/image.png"/>
</Button>

I want a button with an image, in which only the button is transparent. I've tried it that way, and by putting: Opacity="0" it puts everything transparent, and I want it to just be transparent.

like image 615
Fernando Sousa Avatar asked Dec 09 '25 12:12

Fernando Sousa


1 Answers

Method 1

Set Opacity="0" for Button.Background. You can do it by using below code.

<Button>
    <Button.Background>
        <SolidColorBrush Opacity="0"/>
    </Button.Background>
</Button>

Method 2

Set #00000000 as the background color of the Button. Since UWP support ARGB(Alpha RGB) color you can directly set opacity for any color in UWP app.

<Button Background="#00000000"/>
like image 83
Vijay Nirmal Avatar answered Dec 12 '25 04:12

Vijay Nirmal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!