views:

104

answers:

1

When I change the style of my window to WindowStyle="None" and AllowsTransparency="True" I lose the inactive window visuals. Is there a trigger I can use in the XAML style that can show a hidden mask or opacity changes in the main window when another window has focus? I'd like to be able to achieve this within the XAML and not programatically.

A: 

You can change an opacity mask of window by changing OpacityMask property with trigger when Window.IsActive is true. OpacityMask is a brush so you can provide anything you want, including gradient or something more complex. If I remember correctly framework will take only alpha channel from this brush.

Kaagle
I found IsActive right after posting. Here's what I added to the style for my custom title bar:<Style.Triggers> <DataTrigger Value="False" Binding="{Binding Path=IsActive, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" > <Setter Property="Background" Value="{StaticResource GlossGray}"/> </DataTrigger></Style.Triggers>