【问题标题】:How to create a Custom Drop down with Autocomplete feature in xamarin forms?如何在 xamarin 表单中使用自动完成功能创建自定义下拉菜单?
【发布时间】:2019-06-01 23:38:47
【问题描述】:

我想在 xamarin 表单中创建一个具有自动完成功能的自定义下拉菜单。到目前为止,我发现我只能使用 Syncfusion 来实现这一点。但我不想使用 Syncfusion。在 xamarin 表单中的大多数代码中,他们使用选择器作为下拉菜单。但是如果我使用选择器,我将无法获得下拉菜单的自动完成功能。我需要这样的东西

https://www.syncfusion.com/xamarin-ui-controls/combobox

我不知道如何解决这个问题。有什么建议吗?

【问题讨论】:

标签: xamarin xamarin.forms xamarin.ios xamarin.android


【解决方案1】:

您是否看过这个库,它支持使用 Xamarin.forms https://github.com/XamFormsExtended/Xfx.Controls 的所有平台。

<ScrollView>
     <StackLayout HorizontalOptions="FillAndExpand"
                  Padding="10"
                  VerticalOptions="FillAndExpand">
             <controls:CustomCombobox x:Name="listView_Countries" HorizontalOptions="FillAndExpand"
                                  PlaceHolder="{Binding [RelativeInfo_Relationship]}"
                                  ItemsSource="{Binding countryItems}"
                                  ItemDisplay="Description"
                                  SelectedItem="{Binding FirstRelativeRelationship}"
                                  Margin="20,1,20,1" />

在这里 ItemsSource="{Binding countryItems}" // 在这里你可以绑定你的 itemsource

public YourPage()
{
    InitializeComponent();
    BindingContext = this;
    countryManager = new CountryManager();
    countryItems = countryManager.GetCountriesList().ToList();
    listView_Countries.ItemsSource = countryItems; }

【讨论】:

  • 实际上我需要类似的东西。而不是显示电子邮件 ID。我需要查看硬编码的国家/地区列表或州列表。我将在我的问题中附上屏幕截图以便更好地理解。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-10-09
  • 1970-01-01
  • 1970-01-01
  • 2013-05-21
  • 2020-04-23
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多