uriz
uriz

Reputation: 577

WPF button background image with transparency

I have a WPF button
I want to add the button an image background
The image is a PNG with transparency
here is what I have:

<Button
    Width="160"
    Height="55"
    BorderThickness="0">
      <Button.Background>
           <ImageBrush ImageSource="C:\images\mute.png" />
      </Button.Background>
                      Mute
</Button>

How do i set the background to allow transparency?

Upvotes: 1

Views: 7572

Answers (1)

MohamedHamza
MohamedHamza

Reputation: 205

your button control should be like that:

 <Button Background="Transparent" BorderBrush="Transparent" >
                            <ContentControl>
                                <Image Width="160"
                                 Height="55" Source="C:\images\mute.jpg"  />
                            </ContentControl>
                             Mute
                        </Button>

Upvotes: 2

Related Questions