AvaloniaSearchableComboBox 1.0.0

dotnet add package AvaloniaSearchableComboBox --version 1.0.0
                    
NuGet\Install-Package AvaloniaSearchableComboBox -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AvaloniaSearchableComboBox" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AvaloniaSearchableComboBox" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="AvaloniaSearchableComboBox" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AvaloniaSearchableComboBox --version 1.0.0
                    
#r "nuget: AvaloniaSearchableComboBox, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AvaloniaSearchableComboBox@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AvaloniaSearchableComboBox&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=AvaloniaSearchableComboBox&version=1.0.0
                    
Install as a Cake Tool

AvaloniaSearchableComboBox

A searchable ComboBox for Avalonia UI that allows users to filter items by typing. This is especially useful when working with large lists, like selecting a supplier, product, or country from hundreds of options.

Avalonia does not include this component by default, but this project provides a custom implementation that can be integrated easily into your own applications.


✅ Features

  • Auto-filter items based on user input
  • Built as a TemplatedControl for styling and customization
  • Simple integration with MVVM
  • Compatible with .NET 8.0
  • Supports both complex and simple data types

📦 How to Use

1. Add the Project

Add the AvaloniaSearchableComboBox class library to your solution.

Install the Avalonia NuGet package in this project.

2. Reference in App

In your main project, reference the library and include the style resource in App.axaml:

<Application.Resources>
  <ResourceDictionary>
    <ResourceDictionary.MergedDictionaries>
      <ResourceInclude Source="avares://AvaloniaSearchableComboBox/Themes/SearchableComboBox.axaml" />
    </ResourceDictionary.MergedDictionaries>
  </ResourceDictionary>
</Application.Resources>

🍎 Example with Simple Data (Strings)

XAML

<Window
    xmlns:sc="using:AvaloniaSearchableComboBox"
    ...>

<sc:SearchableComboBox
    PlaceholderText="Search Fruit..."
    Width="250"
    ItemsSource="{Binding Fruits}"
    SelectedItem="{Binding SelectedFruit, Mode=TwoWay}" />

ViewModel

public class MainWindowViewModel : ViewModelBase
{
    public ObservableCollection<string> Fruits { get; set; }

    private string? _selectedFruit;
    public string? SelectedFruit
    {
        get => _selectedFruit;
        set => SetProperty(ref _selectedFruit, value);
    }

    public MainWindowViewModel()
    {
        Fruits = new ObservableCollection<string>
        {
            "Banana",
            "Apple",
            "Peach"
        };
    }
}

🧠 Example with Complex Data

XAML

<Window
    xmlns:sc="using:AvaloniaSearchableComboBox"
    ...>

  <StackPanel Spacing="10" Margin="20">
    <sc:SearchableComboBox
        PlaceholderText="Search Country..."
        Width="250"
        ItemsSource="{Binding Countries}"
        SelectedItem="{Binding SelectedCountry, Mode=TwoWay}" />

    <TextBlock Text="{Binding SelectedCountry.Name, StringFormat='Selected Country: {0}'}"/>
    <TextBlock Text="{Binding SelectedCountry.Code, StringFormat='Country Code: {0}'}"/>
    <TextBlock Text="{Binding SelectedCountry.Region, StringFormat='Region: {0}'}"/>
  </StackPanel>
</Window>

ViewModel

public class MainWindowViewModel : ViewModelBase
{
    private ObservableCollection<Country> _countries;
    private Country? _selectedCountry;

    public ObservableCollection<Country> Countries
    {
        get => _countries;
        set => SetProperty(ref _countries, value);
    }

    public Country? SelectedCountry
    {
        get => _selectedCountry;
        set
        {
            SetProperty(ref _selectedCountry, value);
            System.Diagnostics.Debug.WriteLine($"SelectedCountry changed to: {value?.Name ?? "null"}");
        }
    }

    public MainWindowViewModel()
    {
        Countries = new ObservableCollection<Country>
        {
            new("Argentina", "AR", "South America"),
            new("Brasil", "BR", "South America"),
            new("Chile", "CL", "South America"),
            new("Colombia", "CO", "South America"),
            new("Costa Rica", "CR", "Central America"),
            new("Ecuador", "EC", "South America"),
            new("México", "MX", "North America"),
            new("Panamá", "PA", "Central America"),
            new("Perú", "PE", "South America"),
            new("Uruguay", "UY", "South America"),
            new("Venezuela", "VE", "South America")
        };
    }
}

Model

public class MainWindowViewModel : ViewModelBase
{
    private ObservableCollection<Country> _countries;
    private Country? _selectedCountry;

    public ObservableCollection<Country> Countries
    {
        get => _countries;
        set => SetProperty(ref _countries, value);
    }

    public Country? SelectedCountry
    {
        get => _selectedCountry;
        set
        {
            SetProperty(ref _selectedCountry, value);
            System.Diagnostics.Debug.WriteLine($"SelectedCountry changed to: {value?.Name ?? "null"}");
        }
    }

    public MainWindowViewModel()
    {
        Countries = new ObservableCollection<Country>
        {
            new("Argentina", "AR", "South America"),
            new("Brasil", "BR", "South America"),
            new("Chile", "CL", "South America"),
            new("Colombia", "CO", "South America"),
            new("Costa Rica", "CR", "Central America"),
            new("Ecuador", "EC", "South America"),
            new("México", "MX", "North America"),
            new("Panamá", "PA", "Central America"),
            new("Perú", "PE", "South America"),
            new("Uruguay", "UY", "South America"),
            new("Venezuela", "VE", "South America")
        };
    }
}

🎨 Styling & Customization

Since this is a TemplatedControl, you can modify the visual appearance using the control template defined in SearchableComboBox.axaml. You can also override styles or merge your own theme dictionary for complete visual integration.


🛠 Requirements

  • .NET 8.0 SDK
  • Avalonia UI (>=11.3.2)
  • Compatible with MVVM Toolkit (e.g., CommunityToolkit.Mvvm)

📄 License

This project is licensed under the MIT License.


💡 Inspiration

Inspired by the AutoCompleteComboBox behavior from ControlsFX in JavaFX, this control brings similar usability improvements to Avalonia applications.


🙌 Contributing

Feel free to open issues, fork, and submit pull requests! Contributions and feedback are welcome.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
1.0.0 126 7/28/2025