{"id":15011670,"url":"https://github.com/zleao/zoft.mauiextensions.autocompleteentry","last_synced_at":"2025-04-12T03:30:56.576Z","repository":{"id":65338049,"uuid":"571311448","full_name":"zleao/zoft.MauiExtensions.AutoCompleteEntry","owner":"zleao","description":"AutoComplete Entry control for .Net MAUI that provides a list of suggestions as the user types","archived":false,"fork":false,"pushed_at":"2025-02-21T10:50:54.000Z","size":4990,"stargazers_count":39,"open_issues_count":5,"forks_count":13,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-25T23:24:06.243Z","etag":null,"topics":["autocomplete","csharp","dotnet8","entry","maui","nuget","nuget-package"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zleao.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-27T20:24:28.000Z","updated_at":"2025-03-25T07:32:01.000Z","dependencies_parsed_at":"2024-08-26T10:10:06.744Z","dependency_job_id":"08348b5a-900b-44cc-84b5-1185c3fcc2a4","html_url":"https://github.com/zleao/zoft.MauiExtensions.AutoCompleteEntry","commit_stats":{"total_commits":56,"total_committers":3,"mean_commits":"18.666666666666668","dds":0.0892857142857143,"last_synced_commit":"fa4367b9073dfaf5c59e985cb691b2a210f1b69c"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zleao%2Fzoft.MauiExtensions.AutoCompleteEntry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zleao%2Fzoft.MauiExtensions.AutoCompleteEntry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zleao%2Fzoft.MauiExtensions.AutoCompleteEntry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zleao%2Fzoft.MauiExtensions.AutoCompleteEntry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zleao","download_url":"https://codeload.github.com/zleao/zoft.MauiExtensions.AutoCompleteEntry/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248512485,"owners_count":21116612,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["autocomplete","csharp","dotnet8","entry","maui","nuget","nuget-package"],"created_at":"2024-09-24T19:41:25.307Z","updated_at":"2025-04-12T03:30:54.657Z","avatar_url":"https://github.com/zleao.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# zoft.MauiExtensions.Controls.AutoCompleteEntry\n\nEntry control that makes suggestions to users as they type.\n\n**NOTE:** This control is based on the awesome [dotMortem/XamarinFormsControls/AutoSuggestBox](https://github.com/dotMorten/XamarinFormsControls/tree/main/AutoSuggestBox). with some simplifications and modifications of my own.\n\n[![NuGet](https://img.shields.io/nuget/v/zoft.MauiExtensions.Controls.AutoCompleteEntry.svg)](https://www.nuget.org/packages/zoft.MauiExtensions.Controls.AutoCompleteEntry/)\n\n## Getting Started\n\n### Instalation\n\nAdd NuGet Package to your project: \n```\ndotnet add package zoft.MauiExtensions.Controls.AutoCompleteEntry`\n```\nYou can find the nuget package here [zoft.MauiExtensions.Controls.AutoCompleteEntry](https://www.nuget.org/packages/zoft.MauiExtensions.Controls.AutoCompleteEntry/)\n\n\u003cbr/\u003e\n\nInitialize the library in your `MauiProgram.cs` file:\n\n```csharp\nusing CommunityToolkit.Maui;\nusing zoft.MauiExtensions.Controls;\n\nnamespace AutoCompleteEntry.Sample\n{\n    public static class MauiProgram\n    {\n        public static MauiApp CreateMauiApp()\n        {\n            var builder = MauiApp.CreateBuilder();\n            builder\n                .UseMauiApp\u003cApp\u003e()\n                .UseMauiCommunityToolkit()\n                .UseZoftAutoCompleteEntry()\n                .ConfigureFonts(fonts =\u003e\n                {\n                    fonts.AddFont(\"OpenSans-Regular.ttf\", \"OpenSansRegular\");\n                    fonts.AddFont(\"OpenSans-Semibold.ttf\", \"OpenSansSemibold\");\n                });\n\n            return builder.Build();\n        }\n    }\n}\n```\n\n\u003cbr/\u003e\n\n### How to Use\n\nThe filtering of results, happens as the user types and you'll only need to respond to 2 actions:\n\n**Binding based**\n- `TextChangedCommand`: Triggered every time the user changes the text. Receives the current text as parameter;\n- `SelectedSuggestion`: Holds the currently selected option;\n\n**Event based**\n- `TextChanged`: Event raised every time the user changes the text. The current text is part of the event arguments;\n- `SuggestionChosen`: Event raised every time a suggestion is chosen. The selected option is part of the event arguments;\n\n\u003cbr/\u003e\n\n### XAML Usage\nIn order to make use of the control within XAML you can use this namespace:\n\n```xml\nxmlns:zoft=\"http://zoft.MauiExtensions/Controls\"\n```\n\n\u003cbr/\u003e\n\n### Sample Using Bindings\n\n```xml\n\u003cContentPage ...\n             xmlns:zoft=\"http://zoft.MauiExtensions/Controls\"\n             ...\u003e\n\n    \u003czoft:AutoCompleteEntry Placeholder=\"Search for a country or group\"\n                            ItemsSource=\"{Binding FilteredList}\"\n                            TextMemberPath=\"Country\"\n                            DisplayMemberPath=\"Country\"\n                            TextChangedCommand=\"{Binding TextChangedCommand}\"\n                            CursorPosition=\"{Binding CursorPosition, Mode=TwoWay}\"\n                            SelectedSuggestion=\"{Binding SelectedItem}\"\n                            Completed=\"AutoCompleteEntry_Completed\"\n                            ClearButtonVisibility=\"Never\"\n                            HeightRequest=\"50\"/\u003e\n\u003c/ContentPage\u003e\n\n```\n```csharp\ninternal partial class ListItem : ObservableObject\n{\n    [ObservableProperty]\n    public string _group;\n\n    [ObservableProperty]\n    public string _country;\n}\n\ninternal partial class SampleViewModel : CoreViewModel\n{\n    private readonly List\u003cListItem\u003e Teams  = new List\u003cListItem\u003e() { ... };\n    \n    [ObservableProperty]\n    private ObservableCollection\u003cListItem\u003e _filteredList;\n\n    [ObservableProperty]\n    private ListItem _selectedItem;\n\n\t[ObservableProperty]\n    private int _cursorPosition;\n\n    public SampleViewModel()\n    {\n        FilteredList = new(Teams);\n        SelectedItem = null;\n    }\n\n    private void FilterList(string filter)\n    {\n        SelectedItem = null;\n        FilteredList.Clear();\n\n        FilteredList.AddRange(Teams.Where(t =\u003e t.Group.Contains(filter, StringComparison.CurrentCultureIgnoreCase) ||\n                                               t.Country.Contains(filter, StringComparison.CurrentCultureIgnoreCase)));\n    }\n\n\t[RelayCommand]\n    private void TextChanged(string text)\n    {\n        FilterList(text);\n    }\n}\n```\n\n\n\u003cbr/\u003e\n\n### Sample Using Events\n\n```xml\n\u003cContentPage ...\n             xmlns:zoft=\"http://zoft.MauiExtensions/Controls\"\n             ...\u003e\n\n    \u003czoft:AutoCompleteEntry Placeholder=\"Search for a country or group\"\n                            ItemsSource=\"{Binding FilteredList}\"\n                            TextMemberPath=\"Country\"\n                            DisplayMemberPath=\"Country\"\n                            TextChanged=\"AutoCompleteEntry_TextChanged\"\n                            CursorPosition=\"{Binding CursorPosition, Mode=TwoWay}\"\n                            CursorPositionChanged=\"AutoCompleteEntry_CursorPositionChanged\"\n                            SuggestionChosen=\"AutoCompleteEntry_SuggestionChosen\"\n                            Completed=\"AutoCompleteEntry_Completed\"\n                            ClearButtonVisibility=\"WhileEditing\"\n                            HeightRequest=\"50\"/\u003e\n\u003c/ContentPage\u003e\n\n```\n```csharp\nprivate void AutoCompleteEntry_TextChanged(object sender, zoft.MauiExtensions.Controls.AutoCompleteEntryTextChangedEventArgs e)\n{\n    // Filter only when the user is typing\n    if (e.Reason == zoft.MauiExtensions.Controls.AutoCompleteEntryTextChangeReason.UserInput)\n    {\n        //Filter the ItemsSource, based on text\n        ViewModel.FilterList((sender as zoft.MauiExtensions.Controls.AutoCompleteEntry).Text);\n    }\n}\n\nprivate void AutoCompleteEntry_SuggestionChosen(object sender, zoft.MauiExtensions.Controls.AutoCompleteEntrySuggestionChosenEventArgs e)\n{\n    //Set the SelectedItem provided by the event arguments\n    ViewModel.SelectedItem = e.SelectedItem as ListItem;\n}\n```\n\n\u003cbr/\u003e\n\u003cbr/\u003e\n\n#### Windows\n\n|![](docs/Windows_1.png)|![](docs/Windows_2.png)|![](docs/Windows_3.png)|![](docs/Windows_4.png)|\n|:---:|:---:|:---:|:---:|\n\n#### Android\n\n|![](docs/Android_1.png)|![](docs/Android_2.png)|![](docs/Android_3.png)|![](docs/Android_4.png)|\n|:---:|:---:|:---:|:---:|\n\n#### iOS\n\n|![](docs/iOS_1.png)|![](docs/iOS_2.png)|![](docs/iOS_3.png)|![](docs/iOS_4.png)|\n|:---:|:---:|:---:|:---:|\n\n#### MacCatalyst\n\n|![](docs/MacCatalyst_1.png)|![](docs/MacCatalyst_2.png)|![](docs/MacCatalyst_3.png)|![](docs/MacCatalyst_4.png)|\n|:---:|:---:|:---:|:---:|\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzleao%2Fzoft.mauiextensions.autocompleteentry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzleao%2Fzoft.mauiextensions.autocompleteentry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzleao%2Fzoft.mauiextensions.autocompleteentry/lists"}