5

I have a list view, on a panoramic control. I've also created an event for MouseLeftButtonUp however I find that when scrolling between the panorama items the MousLeftButtonUp is triggering (it makes sense why but it is unexpected from a user perspective).

Is there any way to create a click event for a list? Or add a behavior that simulates that?

Matt Lacey
  • 65,560
  • 11
  • 91
  • 143
Sebastian Gray
  • 2,590
  • 3
  • 26
  • 36

2 Answers2

8

Checkout the Tap gesture from the Gesture service that's part of the toolkit.

WP7 Tip of the Day: Silverlight Toolkit: Gestures

    <ListBox Height="100" HorizontalAlignment="Left" Margin="12,186,0,0" Name="listBox1" VerticalAlignment="Top" Width="460" >
        <Controls:GestureService.GestureListener>
            <Controls:GestureListener Tap="GestureListener_Tap">
            </Controls:GestureListener>
        </Controls:GestureService.GestureListener>
        <ListBoxItem Content="1"/>
        <ListBoxItem Content="2"/>
        <ListBoxItem Content="3"/>
        <ListBoxItem Content="4"/>
    </ListBox>

and

public void GestureListener_Tap(object sender, GestureEventArgs e) {
    System.Diagnostics.Debug.WriteLine("tap");
}
Mick N
  • 14,892
  • 2
  • 35
  • 41
0

The listbox should already accept contact, so you can just fire the SelectionChanged event

sphilp
  • 1
  • 5
    This is true, however it won't fire on a second tap if there is no change in selection. This is usually what prompts people to go looking for other options like adding buttons, checking mouseleftbuttonup, etc. – Mick N Jan 09 '11 at 05:40