Is there a click behavior for a list?

倖福魔咒の 提交于 2019-11-30 10:06:20

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");
}

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!