I apply opacity 0.75 for the Grid
and all children which has Grid
also take the opacity.
Is it possible to exclude child Controls and don't apply opacity for them?
Thank you!
XAML
<Grid x:Name="RootGrid" Opacity="0.75" Visibility="Visible" ClipToBounds="False"
VerticalAlignment="Stretch" HorizontalAlignment="Stretch" >
<local:MarqueeVer x:Name="marquee1" Duration="30" ClipToBounds="True"
RenderTransformOrigin="0.5,0.5" Margin="0,0,0,0"
VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
Background="Transparent" Opacity="1">
<StackPanel Name="lstItems" FlowDirection="LeftToRight" Orientation="Vertical"
VirtualizingStackPanel.IsVirtualizing="True"
VirtualizingStackPanel.VirtualizationMode="Recycling">
</StackPanel>
</local:MarqueeVer>
</Grid>
UPDATE:
I found some solution here but is any simpler solution?
You just have to calculate the right alpha channel for each color.
If you only want to change the opacity of the grid's background, then you need to set the opacity=0.75 only in the background image.
But what I Apply some Brush to the Grid? WHat I can do in thhat case?
In the that case set the opacity in the brush
To achieve this effect, you can add a Rectangle
as a child of the Grid
(but as a sibling to the other elements) and apply the Background
and Opacity
to the Rectangle
. This way, the change of opacity doesn't affect the other children of the Grid
.
<Grid Name="Root">
<Rectangle Name="Background" Opacity="0.75">
<Rectangle.Fill>
</Rectangle.Fill>
</Rectangle>
<Label>Hello World</Label>
</Grid>
I know this is probably a dirty solution, but it did the trick for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With