buttons inside scrollviewer problem

Posted by Miroslav Valchev on Stack Overflow See other posts from Stack Overflow or by Miroslav Valchev
Published on 2011-01-11T20:48:32Z Indexed on 2011/01/11 20:54 UTC
Read the original article Hit count: 199

Hello, everyone. I couldn't find a solution to my problem eventhough I believe that others have come across this too. Basically, there are like twenty buttons in a wrap panel, which is inside a scrollviewer. The problem is that when I want to scroll the list, the click event fires the triggers. Really would appreciate help on this one.

<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>

© Stack Overflow or respective owner

Related posts about Silverlight

Related posts about windows-phone-7