我想在选取器中添加一个点击手势-这样当一个值被选中(双击)时,我就可以调用一个方法。我已经尝试了以下几种方法。但它永远不会开火!有什么想法吗?
<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"
发布于 2017-05-19 22:11:52
我不知道你怎么能以你想要的方式做到这一点,但是你可以触发selectedindexchanged。如果我是对的,这应该会在用户选择50个状态中的一个状态时触发。这里有一些关于选取器的文档。https://developer.xamarin.com/api/type/Xamarin.Forms.Picker
如果你想使用一个可绑定的选择器,你应该使用这个:https://forums.xamarin.com/discussion/30801/xamarin-forms-bindable-picker
如果这对你有帮助,请告诉我。
编辑:选取器现在默认是可绑定的
https://stackoverflow.com/questions/43927826
复制相似问题