简体   繁体   English

在 xamarin.forms 中自定义下拉(选择器)列表

[英]Customize dropdown (Picker) list in xamarin.forms

I am working on xamarin.forms.我正在研究 xamarin.forms。 I am creating an app for android.我正在为 android 创建一个应用程序。 In app I have a dropdown list.在应用程序中,我有一个下拉列表。 I am using Picker for it.我正在使用 Picker。 I customized it to look like dropdown.我将它定制为看起来像下拉菜单。 Now I need to make the first Index item to nonselactable.现在我需要将第一个索引项设为不可选择。 Means user can not select the first item.意味着用户不能选择第一项。 If user click on it nothing should happen.如果用户点击它什么都不应该发生。 But currently when user click on the first index dropdown gets collapsed.但是目前当用户单击第一个索引下拉列表时会折叠。

One more thing that I have to add in dropdown is a Cross button at index 1. Means at index 1, on left side there will be Cross button and at center there will be text like Select item.我必须在下拉列表中添加的另一件事是索引 1 处的十字按钮。意味着在索引 1 处,左侧将有十字按钮,在中心将有类似选择项的文本。 And this whole row should not be selctable.并且这整行不应该是可选择的。 If user click at cross button dropdown should collapsed.如果用户单击十字按钮下拉菜单应折叠。

Anyone have idea how I can do this?任何人都知道我该怎么做?

您可以将列表视图用于下拉列表并根据需要控制其可见性。我遇到了类似的情况,我自定义列表视图以制定下拉列表。我想了解关于 Picker 的另一件事。您的选择器是否只接受或添加字符串,或者您可以自定义它接受意见或控制?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM