uwp复选框双击

时间:2017-02-15 10:19:47

标签: checkbox uwp

当UWP在父网格上设置Tapped事件时,会自动选中子复选框以进行双击。

我想检查子项复选框为Tapped,而不是双Tapped

感谢您的回复。

<Grid Background="Black" >
    <interactivity:Interaction.Behaviors>
    <core:EventTriggerBehavior EventName="Tapped">
        <core:InvokeCommandAction Command="{Binding DataContext.SelectDefectImageCommand, ElementName=PART_ItemList}" CommandParameter="{Binding}" />
    </core:EventTriggerBehavior>
    </interactivity:Interaction.Behaviors>

    <CheckBox IsChecked="{Binding IsSelected, Mode=TwoWay}" Style="{StaticResource WhiteCheckBoxStyle}" VerticalAlignment="Center" Margin="5,0,0,0" />

</Grid>

1 个答案:

答案 0 :(得分:0)

我认为您希望在Grid Tapped事件中设置已检查状态,但结果会被覆盖,因为CheckBox检查也会被触发。您可以通过将CheckBox IsHitTestVisible属性设置为false来阻止此操作,在这种情况下,复选框不会生成指针事件,因此会忽略点击。