WPF,如何调整组框透明度

WPF, how to adjust groupbox transparency

我有一个带有精美背景图片的 WPF 应用程序。但是,当我将一些元素放置到表单中时,我希望它们不那么透明。

例如简单的组框:

   <GroupBox x:Name="LocationGroup" Grid.Column="1" Grid.Row="1" Header="Location" HorizontalAlignment="Left" Height="100" Margin="10,90,0,0" VerticalAlignment="Top" Width="734">
        <Grid Margin="1,1,1,1">

            <Label Content="Location" HorizontalAlignment="Left" Margin="5,5,0,0" VerticalAlignment="Top"/>
            <ComboBox x:Name="LocationCombo" HorizontalAlignment="Left" Margin="5,36,0,0" VerticalAlignment="Top" Width="100"
                      DisplayMemberPath="LocationDescr" SelectedValuePath="LocationNr" SelectedValue="{Binding Path=Location}">
            </ComboBox>

        </Grid>
    </GroupBox>

我试过设置组框(和网格)的不透明度属性,但它只影响标签和组合框的不透明度,不影响背景。

我要找的就是下图右边的元素:

Opacity example

这是实现它的一种方法:

 <Grid>
    <Grid.Background>
        <ImageBrush ImageSource="path\to\backgroundimage"  Stretch="UniformToFill"/>
    </Grid.Background>

    <Grid Grid.Column="1" Grid.Row="1" HorizontalAlignment="Left" Height="100" Width="400" Margin="10,90,0,0" VerticalAlignment="Top">
        <Grid Background="White" Opacity="0.5"></Grid>
        <GroupBox x:Name="LocationGroup" Header="Location">
            <Grid Margin="1,1,1,1">
                <Label Content="Location" HorizontalAlignment="Left" Margin="5,5,0,0" VerticalAlignment="Top"/>
                <ComboBox x:Name="LocationCombo" HorizontalAlignment="Left" Margin="5,36,0,0" VerticalAlignment="Top" Width="100"
                  DisplayMemberPath="LocationDescr" SelectedValuePath="LocationNr" SelectedValue="{Binding Path=Location}">
                </ComboBox>
            </Grid>
        </GroupBox>
    </Grid>
</Grid>