Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Opaque controls on semi-transparent control

I have a StackPanel with some Buttons in it. I want the StackPanel to be semi-transparent, but the buttons to remain opaque. I've been googling for a while but still can't figure this out. I can find solutions for having opaque controls on a semi-transparent window, but not for opaque controls on a semi-transparent control.

like image 816
Brandon Moore Avatar asked Jan 25 '13 06:01

Brandon Moore


1 Answers

When you say semi-transparent StackPanel, you certainly mean the StackPanel's Background. You can always set that to a Brush with an Opacity less than 1. In case of a solid-color background, that would be a SolidColorBrush:

<StackPanel>
    <StackPanel.Background>
        <SolidColorBrush Color="Red" Opacity=".5"/>
    </StackPanel.Background>
    ...
</StackPanel>

or you simply use a color with an appropriate alpha value:

<StackPanel Background="#7FFF0000">
like image 154
Clemens Avatar answered Nov 15 '22 03:11

Clemens