Getting Started with .NET MAUI Autocomplete
29 Jun 20268 minutes to read
This section guides you through setting up and configuring a Autocomplete in your .NET MAUI application. Follow the steps below to add a basic Autocomplete to your project.
To quickly get started with the .NET MAUI Autocomplete, watch this video.
Prerequisites
Before proceeding, ensure the following are in place:
- Install .NET 9 SDK or later.
- Set up a .NET MAUI environment with Visual Studio 2022 v17.12 or later.
Step 1: Create a new .NET MAUI project
- Go to File > New > Project and choose the .NET MAUI App template.
- Name the project and choose a location. Then, click Next.
- Select the .NET framework version and click Create.
Step 2: Install the Syncfusion® MAUI Inputs NuGet package
- In Solution Explorer, right-click the project and choose Manage NuGet Packages.
- Search for Syncfusion.Maui.Inputs and install the latest version.
- Ensure the necessary dependencies are installed correctly, and the project is restored.
Prerequisites
Before proceeding, ensure the following are set up:
- Install .NET 9 SDK or later.
- Set up a .NET MAUI environment with Visual Studio Code.
- Ensure that the .NET MAUI workloads are installed and configured as described here.
Step 1: Create a new .NET MAUI project
- Open the Command Palette by pressing Ctrl+Shift+P and type .NET:New Project and press Enter.
- Choose the .NET MAUI App template.
- Select the project location, type the project name and press Enter.
- Then choose Create project
Step 2: Install the Syncfusion® MAUI Inputs NuGet package
- Press Ctrl + ` (backtick) to open the integrated terminal in Visual Studio Code.
- Ensure you’re in the project root directory where your .csproj file is located.
- Run the command
dotnet add package Syncfusion.Maui.Inputsto install the Syncfusion® .NET MAUI Inputs package. - To ensure all dependencies are installed, run
dotnet restore.
Prerequisites
Before proceeding, ensure the following are set up:
- Install .NET 9 SDK or later.
- Set up a .NET MAUI environment with JetBrains Rider 2024.3 or later.
- Make sure the MAUI workloads are installed and configured as described here.
Step 1: Create a new .NET MAUI project
- Go to File > New Solution, Select .NET (C#) and choose the .NET MAUI App template.
- Enter the Project Name, Solution Name, and Location.
- Select the .NET framework version and click Create.
Step 2: Install the Syncfusion® MAUI Inputs NuGet package
- In Solution Explorer, right-click the project and choose Manage NuGet Packages.
- Search for Syncfusion.Maui.Inputs and install the latest version.
- Ensure the necessary dependencies are installed correctly, and the project is restored. If not, Open the Terminal in Rider and manually run:
dotnet restore
Step 3: Register Syncfusion handler
Make sure to add the namespace.
using Syncfusion.Maui.Core.Hosting;Register the Syncfusion core handler in your CreateMauiApp method of MauiProgram.cs file to use Syncfusion controls.
builder.ConfigureSyncfusionCore();Step 4: Define Model and View Model
Create a simple model class called ‘SocialMedia’ with fields ‘ID’ and ‘Name’, and then populate social media data in the ‘SocialMediaViewModel’.
//Model.cs
public class SocialMedia
{
public string Name { get; set; }
public int ID { get; set; }
}
//ViewModel.cs
public class SocialMediaViewModel
{
public ObservableCollection<SocialMedia> SocialMedias { get; set; }
public SocialMediaViewModel()
{
this.SocialMedias = new ObservableCollection<SocialMedia>();
this.SocialMedias.Add(new SocialMedia() { Name = "Facebook", ID = 0 });
this.SocialMedias.Add(new SocialMedia() { Name = "Google Plus", ID = 1 });
this.SocialMedias.Add(new SocialMedia() { Name = "Instagram", ID = 2 });
this.SocialMedias.Add(new SocialMedia() { Name = "LinkedIn", ID = 3 });
this.SocialMedias.Add(new SocialMedia() { Name = "Skype", ID = 4 });
this.SocialMedias.Add(new SocialMedia() { Name = "Telegram", ID = 5 });
this.SocialMedias.Add(new SocialMedia() { Name = "Televzr", ID = 6 });
this.SocialMedias.Add(new SocialMedia() { Name = "Tik Tok", ID = 7 });
}
}Step 5: Import the Autocomplete namespace
Add the following namespace in your XAML or C#.
xmlns:inputs="clr-namespace:Syncfusion.Maui.Inputs;assembly=Syncfusion.Maui.Inputs"using Syncfusion.Maui.Inputs;Step 6: Add the Autocomplete component
Create an instance for the Autocomplete control. Now, populate this ‘SocialMediaViewModel’ data in the Autocomplete control by binding to the ItemsSource property.
The .NET MAUI Autocomplete control is populated with a list of social media options. However, since the ‘SocialMedia’ model includes two properties, ‘Name’ and ‘ID’, it’s necessary to specify which property should be used as the display value in both the selection box portion and the drop-down suggestion list of the Autocomplete control.
TextMemberPath: This property path is used to retrieve the value that will be displayed in the selection box portion of the .NET MAUI Autocomplete control when an item is selected. The default value is String.Empty.
DisplayMemberPath: This property path is used to specify the name or path of the property that will be displayed for each data item in the drop-down list. The default value is String.Empty.
<inputs:SfAutocomplete WidthRequest="250"
HeightRequest = "40"
DisplayMemberPath = "Name"
TextMemberPath = "Name"
ItemsSource="{Binding SocialMedias}">
<inputs:SfAutocomplete.BindingContext>
<local:SocialMediaViewModel />
</inputs:SfAutocomplete.BindingContext>
</inputs:SfAutocomplete>SocialMediaViewModel socialMediaViewModel = new SocialMediaViewModel();
SfAutocomplete autocomplete = new SfAutocomplete
{
WidthRequest = 250,
HeightRequest = 40,
DisplayMemberPath = "Name",
TextMemberPath = "Name",
BindingContext = socialMediaViewModel,
ItemsSource = socialMediaViewModel.SocialMedias,
};The following image illustrates the output:

You can download the Autocomplete Getting Started sample from GitHub
NOTE
Set the BindingContext of your page to an instance of SocialMediaViewModel. This allows you to bind the properties of SocialMediaViewModel to the Autocomplete control.
NOTE
When publishing in AOT mode on iOS, ensure [Preserve(AllMembers = true)] is added to the model class to maintain DisplayMemberPath binding
NOTE
You can refer to our .NET MAUI Autocomplete feature tour page for its groundbreaking feature representations. You can also explore our .NET MAUI Autocomplete Example that shows you how to render the Autocomplete in .NET MAUI.