我想为选择器添加一个轻击手势 - 所以当选择一个值(双击)时,我可以调用一个方法。我尝试了以下内容。但它永远不会发射!有什么想法吗?
<Picker Grid.Row="5" Margin="0,0,100,0" Title=" -Select State" SelectedIndex="{Binding StatesSelectedIndex, Mode=TwoWay}" ItemsSource="{Binding PPStates}" ItemDisplayBinding="{Binding Path=[display_name]}">
<Picker.GestureRecognizers>
<TapGestureRecognizer
Command="{Binding OnTapPicker}"
NumberOfTapsRequired="1" />
</Picker.GestureRecognizers>
</Picker>
我已经厌倦了示例代码了 https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/gestures/tap/
添加此Tapped="OnTapGestureRecognizerTapped"
答案 0 :(得分:1)
我不知道你怎么能以你想要的方式做到这一点,但是你可以解雇所选择的。如果我正确,当用户选择50个状态中的一个时,应该触发。这里有一些关于选择器的文档。 https://developer.xamarin.com/api/type/Xamarin.Forms.Picker
如果您想使用可绑定的选择器,您应该使用: https://forums.xamarin.com/discussion/30801/xamarin-forms-bindable-picker
请告诉我这是否对您有所帮助。
编辑: 现在默认情况下,拣货员可以绑定