v.chjen
v.chjen

Reputation: 625

WPF button with transparent background image

I want to create an image button in WPF. So far I have that solution:

<Button Click="btn_Click" Name="btnDelete" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"         Grid.Row="2" Grid.Column="2" BorderBrush="{x:Null}" VerticalContentAlignment="Top" FontSize="15"     FontWeight="Bold" >
    <StackPanel>
         <TextBlock TextAlignment="Center" Name="btnDelete_text" Text="Verwijderen" />
         <Image Stretch="Fill" Name="btnDeleteProductImage" Width="90" Height="90" Source="    {StaticResource delete}" />
    </StackPanel>
</Button>

But the problem is that the image I'm using has transparent background, which is shown as white on the button. How I can make it really transparent?

My buttons shows a white background instead of transparent.

Button, which I hv created. White background is shown, instead of transparency./

Upvotes: 0

Views: 2251

Answers (2)

Peter
Peter

Reputation: 493

The image with transparent background should appear transparent by default (without additional settings). I think the problem is in the image (as it was mentioned in the first comment). It looks like the image was saved with a backgound during some transformation in a editor. Give a try to a different PNG (I assume it is a PNG) with the transparent background and see what it gives.

Upvotes: 1

Sajeetharan
Sajeetharan

Reputation: 222722

Check your Image in PNG format , i think even if you have a background transparent image format is different.

Upvotes: 0

Related Questions