Search code examples
c#wpftransparency

WPF Transparent background


Please note that I´m slowly shifting from WinForms to WPF so this might be trivial :/

I´m trying to have 2 radio buttons partly overlapping, the problem is that even tho I have Background="Transparent" I still can see the background hiding part of my second radio button.

figure 1

And here is my wpf code enter image description here

Thank you for your time :)

Pajamac out.


Solution

  • You need to set the styles on the RadioButton to transparent. Place this code in your App.xaml of your WPF app, it will change any RadioButton to transparent.

    <Style TargetType="{x:Type RadioButton}">
           <Setter Property="Background" Value="Transparent"/>
           <Setter Property="BorderBrush" Value="Transparent"/>
    </Style>