zoft.MauiExtensions.Controls.AutoCompleteEntry
1.0.0
See the version list below for details.
dotnet add package zoft.MauiExtensions.Controls.AutoCompleteEntry --version 1.0.0
NuGet\Install-Package zoft.MauiExtensions.Controls.AutoCompleteEntry -Version 1.0.0
<PackageReference Include="zoft.MauiExtensions.Controls.AutoCompleteEntry" Version="1.0.0" />
paket add zoft.MauiExtensions.Controls.AutoCompleteEntry --version 1.0.0
#r "nuget: zoft.MauiExtensions.Controls.AutoCompleteEntry, 1.0.0"
// Install zoft.MauiExtensions.Controls.AutoCompleteEntry as a Cake Addin #addin nuget:?package=zoft.MauiExtensions.Controls.AutoCompleteEntry&version=1.0.0 // Install zoft.MauiExtensions.Controls.AutoCompleteEntry as a Cake Tool #tool nuget:?package=zoft.MauiExtensions.Controls.AutoCompleteEntry&version=1.0.0
zoft.MauiExtensions.Controls.AutoCompleteEntry
Entry control that makes suggestions to users as they type.
NOTE: This control is based on the awesome dotMortem/XamarinFormsControls/AutoSuggestBox. with some simplifications and modifications of my own.
Getting Started
Instalation
Add NuGet Package to your project:
dotnet add package zoft.MauiExtensions.Controls.AutoCompleteEntry`
You can find the nuget package here zoft.MauiExtensions.Controls.AutoCompleteEntry
<br/>
How to Use
The filtering of results, happens as the user types and you'll only need to respond to 2 actions:
Binding based
TextChangedCommand
: Triggered every time the user changes the text. Receives the current text as parameter;SelectedSuggestion
: Holds the currently selected option;
Event based
TextChanged
: Event raised every time the user changes the text. The current text is part of the event arguments;SuggestionChosen
: Event raised every time a suggestion is chosen. The selected option is part of the event arguments;
<br/>
Sample Using Bindings
<ContentPage ...
xmlns:zoft="http://zoft.MauiExtensions/Controls"
...>
<zoft:AutoCompleteEntry Placeholder="Search for a country or group"
ItemsSource="{Binding FilteredList}"
TextMemberPath="Country"
DisplayMemberPath="Country"
TextChangedCommand="{Binding TextChangedCommand}"
SelectedSuggestion="{Binding SelectedItem}"/>
</ContentPage>
internal partial class ListItem : ObservableObject
{
[ObservableProperty]
public string _group;
[ObservableProperty]
public string _country;
}
internal partial class SampleViewModel : CoreViewModel
{
private readonly List<ListItem> Teams = new List<ListItem>() { ... }
[ObservableProperty]
private ObservableCollection<ListItem> _filteredList;
[ObservableProperty]
private ListItem _selectedItem;
public Command<string> TextChangedCommand { get; }
public SampleViewModel()
{
FilteredList = new(Teams);
SelectedItem = null;
TextChangedCommand = new Command<string>(FilterList);
}
private void FilterList(string filter)
{
SelectedItem = null;
FilteredList.Clear();
FilteredList.AddRange(Teams.Where(t => t.Group.Contains(filter, StringComparison.CurrentCultureIgnoreCase) ||
t.Country.Contains(filter, StringComparison.CurrentCultureIgnoreCase)));
}
}
<br/>
Sample Using Events
<ContentPage ...
xmlns:zoft="http://zoft.MauiExtensions/Controls"
...>
<zoft:AutoCompleteEntry Placeholder="Search for a country or group"
ItemsSource="{Binding FilteredList}"
TextMemberPath="Country"
DisplayMemberPath="Country"
TextChanged="AutoCompleteEntry_TextChanged"
SuggestionChosen="AutoCompleteEntry_SuggestionChosen"/>
</ContentPage>
private void AutoCompleteEntry_TextChanged(object sender, zoft.MauiExtensions.Controls.AutoCompleteEntryTextChangedEventArgs e)
{
// Filter only when the user is typing
if (e.Reason == zoft.MauiExtensions.Controls.AutoCompleteEntryTextChangeReason.UserInput)
{
//Filter the ItemsSource, based on text
ViewModel.FilterList((sender as zoft.MauiExtensions.Controls.AutoCompleteEntry).Text);
}
}
private void AutoCompleteEntry_SuggestionChosen(object sender, zoft.MauiExtensions.Controls.AutoCompleteEntrySuggestionChosenEventArgs e)
{
//Set the SelectedItem provided by the event arguments
ViewModel.SelectedItem = e.SelectedItem as ListItem;
}
<br/> <br/>
Windows
Android
iOS
MacCatalyst
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-android31.0 is compatible. net6.0-ios was computed. net6.0-ios16.1 is compatible. net6.0-maccatalyst was computed. net6.0-maccatalyst16.1 is compatible. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net6.0-windows10.0.19041 is compatible. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- zoft.MauiExtensions.Core (>= 1.2.0)
-
net6.0-android31.0
- zoft.MauiExtensions.Core (>= 1.2.0)
-
net6.0-ios16.1
- System.Runtime.InteropServices.NFloat.Internal (>= 6.0.1)
- zoft.MauiExtensions.Core (>= 1.2.0)
-
net6.0-maccatalyst16.1
- Microsoft.Maui.Graphics (>= 6.0.501)
- System.Runtime.InteropServices.NFloat.Internal (>= 6.0.1)
- zoft.MauiExtensions.Core (>= 1.2.0)
-
net6.0-windows10.0.19041
- zoft.MauiExtensions.Core (>= 1.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
3.0.8 | 1,696 | 8/30/2024 |
3.0.7 | 108 | 8/29/2024 |
3.0.6 | 118 | 8/28/2024 |
3.0.5 | 128 | 8/27/2024 |
3.0.4 | 118 | 8/26/2024 |
3.0.3 | 131 | 8/23/2024 |
3.0.2 | 2,261 | 5/24/2024 |
3.0.1 | 109 | 5/23/2024 |
3.0.0 | 129 | 5/23/2024 |
2.0.0 | 6,966 | 4/8/2023 |
1.0.0 | 630 | 12/16/2022 |
1.0.0-RC4 | 131 | 12/15/2022 |
1.0.0-RC3 | 134 | 12/15/2022 |
1.0.0-RC2 | 142 | 12/15/2022 |
1.0.0-RC1 | 131 | 11/27/2022 |
Entry control that makes suggestions to users as they type.