滚动查看器内部的按钮问题

时间:2011-01-11 20:48:32

标签: silverlight windows-phone-7

大家。我无法找到解决问题的方法,尽管我相信其他人也遇到了这个问题。基本上,在包裹面板中有二十个按钮,它们位于滚动查看器内。问题是,当我想滚动列表时,click事件会触发触发器。真的很感激这个的帮助。

<ScrollViewer>
<ScrollViewer.Content>
    <toolkit:WrapPanel Orientation="Horizontal"
                                   HorizontalAlignment="Left"
                                   VerticalAlignment="Top"
                                   Width="420">
        <Button Style="{StaticResource imageButtonStyle}" >
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="Click">
                    <cmd2:EventToCommand Command="{Binding SelectCommand, Mode=OneWay}"
                        CommandParameterValue="1" />
                </i:EventTrigger>
            </i:Interaction.Triggers>               
        </Button>
        <Button Style="{StaticResource imageButtonStyle}">
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="Click">
                    <cmd2:EventToCommand Command="{Binding SelectCommand, Mode=OneWay}"
                                                     CommandParameterValue="2" />
                </i:EventTrigger>
            </i:Interaction.Triggers>                
        </Button>
        <Button Style="{StaticResource imageButtonStyle}">
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="MouseEnter">
                    <cmd2:EventToCommand Command="{Binding SelectCommand, Mode=OneWay}"
                                                     CommandParameterValue="3" />
                </i:EventTrigger>
            </i:Interaction.Triggers>                
        </Button>
        <Button Style="{StaticResource imageButtonStyle}">
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="MouseEnter">
                    <cmd2:EventToCommand Command="{Binding SelectCommand, Mode=OneWay}"
                                                     CommandParameterValue="4" />
                </i:EventTrigger>
            </i:Interaction.Triggers>                
        </Button>
    </toolkit:WrapPanel>
</ScrollViewer.Content>

1 个答案:

答案 0 :(得分:3)

尝试使用silverlight工具包http://silverlight.codeplex.com/releases/view/52297的手势监听器部分来区分点击和轻弹,而不是使用事件