如何使用 xamarain 表单实时显示 firebase 的选取器项目并在选择项目时添加到 firebase
我想显示 firebase 中的选择器项目,如何做到这一点?
<Picker x:Name="AppointmentPatientName" Title="Patient Name" >
<Picker.Items>
<x:String>Ahmad</x:String>
<x:String>Ali</x:String>
<x:String>Omar</x:String>
<x:String>Alma</x:String>
<x:String>Aya</x:String>
<x:String>Ammar</x:String>
<x:String>Noor</x:String>
</Picker.Items>
</Picker>
I want to display a picker items from firebase how can do this ?
<Picker x:Name="AppointmentPatientName" Title="Patient Name" >
<Picker.Items>
<x:String>Ahmad</x:String>
<x:String>Ali</x:String>
<x:String>Omar</x:String>
<x:String>Alma</x:String>
<x:String>Aya</x:String>
<x:String>Ammar</x:String>
<x:String>Noor</x:String>
</Picker.Items>
</Picker>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当您想使用xamarin表单实时显示firebase的Picker项时,请先从firebase获取项,然后将项绑定到picker。
型号:
获取、添加、删除 Firebase 实时数据库的项目:
绑定选择器:
当您选择项目时想要将项目添加到 Firebase 时,请先获取所选项目,然后添加它。
使用
SelectedIndexChanged
事件获取所选项目。然后调用FirebaseHelper
的 Add 方法。When you want to display Picker item of firebase realtime using xamarin forms, get the items from firebase first and then binding the items to the picker.
Model:
Get, add, delete items for firebase realtime database:
Binding for the Picker:
When you want to add item to firebase when select item, get the selected item first and then add it.
Use the
SelectedIndexChanged
event to get the selected item. And then call the Add method of theFirebaseHelper
.mainpage.xaml.cs
person.cs
firbasehelper.cs
MainPage.xaml.cs
Person.cs
FirebaseHelper.cs