Unfortunately, what you are trying to achieve cannot be directly accomplished with WPF because Opacity
values are kind of inherited by child controls. From the UIElement.Opacity
Property page on MSDN:
Opacity is applied from parent elements on down the element tree to child elements, but the visible effects of the nested opacity settings aren't indicated in the property value of individual child elements. For instance, if a list has a 50% (0.5) opacity and one of its list items has its own opacity set to 20% (0.2), the net visible opacity for that list item will be rendered as if it were 10% (0.1), but the property value of the list item Opacity property would still be 0.2 when queried.
However, it is possible to fake your desired look by making certain elements within the Window
semi opaque, while still having Opacity="1.0"
for child elements. So, try removing the Opacity
setting from the Window
and instead set the Background
to a see through colour like this:
window.Background = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));
Or even simpler:
window.Background = Brushes.Transparent;
Using a combination of transparent colours and low Opacity
values on certain UI elements should get you what you want eventually.