c# - Avalonia UI AXAML styling issue for selector :pointerpressed - Stack Overflow

Trying a pretty straight-forward thing in AXAML.The the background color changes on hover, but not on

Trying a pretty straight-forward thing in AXAML.

The the background color changes on hover, but not on pressed.

I've tried setting IsHitTestVisible of the enclosed label to true and Background of the label to Transparent and {x:Null} in an effort to prevent it from intercepting the click, but that didn't change anything.

I also tried changing the order of the styles so that pressed comes before hover.

<Grid Width="300" Height="100" HorizontalAlignment="Center" VerticalAlignment="Center">
    <Grid.Styles>
        <Style Selector="Grid">
            <Setter Property="Background" Value="DarkSlateGray"/>
        </Style>
        <Style Selector="Grid:pointerover">
            <Setter Property="Background" Value="Red"/>
        </Style>
        <Style Selector="Grid:pointerpressed">
            <Setter Property="Background" Value="MediumPurple"/>
        </Style>
    </Grid.Styles>

    <Label Content="TEST" Foreground="White" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
</Grid>

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744742917a4591134.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信