In XAML, why does a transparent background block this trigger?

This only happens when I set the background to Transparent, which is the effect I need. For example, changing the background for AliceBlue allows the trigger to take effect. What could be missing here backstage?

<Window
    AllowsTransparency="True"
    Background="Transparent">
<Window.Style>
    <Style>
        <Style.Triggers>
            <Trigger Property="Window.IsActive" Value="True">
                <Setter Property="Window.Cursor" Value="ArrowCD" />
            </Trigger>
        </Style.Triggers>
    </Style>
</Window.Style>
<Grid VerticalAlignment="Center" HorizontalAlignment="Center">
    <TextBlock>
        Some Text    
    </TextBlock>
</Grid>
</Window>
+4
source share
1 answer

This is a side effect of how layered windows are handled at the Win32 level: fully transparent pixels (i.e., with zero alpha) are not visible for testing, and therefore will not generate mouse events.

, . , , . Cursor Cursor, , .

+4

All Articles