Buttons inside ListPicker

I have a ListPicker where each item is a musical instrument. You can select only one item at a time. Each item next to the tool name has a button that plays a preview sample.

ListPicker Template:

<DataTemplate x:Name="ListFullModeItemTemplate"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="auto"/> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <c4f:RoundButton Grid.Column="0" Tag="{Binding Id}" ImageSource="/Content/AppBarIcons/play.png" Click="instrumentPreview_Click" /> <TextBlock Grid.Column="1" toolkit:TiltEffect.IsTiltEnabled="True" Text="{Binding Name}" VerticalAlignment="Center" FontSize="35"/> </Grid> </DataTemplate> 

Unfortunately, clicking the button automatically closes the ListPicker dialog box, which is not what I want. I was thinking about marking the instrumentPreview_Click event as processed, but RoutedEventArgs does not have this property in WP7 (unlike WPF)

+4
source share
1 answer

Instead of the Click event, use the Tap event: you get an instance of GestureEventArgs with Handled , which can be set to true !

+3
source

Source: https://habr.com/ru/post/1434196/


All Articles