Custom ComboBox for WPF.
$ dotnet add package ComboBox-WpfA modern, customizable ComboBox control for WPF applications targeting .NET 8. This control provides a clean UI, custom scrollbars, flexible data binding, and easy styling, making it ideal for professional desktop applications.
ItemsSource, SelectedItem, SelectedIndex, and DisplayMemberPath for MVVM-friendly binding.Install via NuGet Package Manager:
Install-Package ComboBox-Wpf
Or via .NET CLI:
dotnet add package ComboBox-Wpf
In your XAML file:
xmlns:combobox="clr-namespace:ComboBox_Wpf"
<combobox:ComboBoxView x:Name="cmbWithMember" SelectedItem="{Binding MySelectedItem, Mode=TwoWay}" ItemsSource="{Binding MyItems}" ShowSearchBar="true" Placeholder="Select Item" DisplayMemberPath="ItemName" />
<combobox:CustomPicker x:Name="cmbStringList" Grid.Column="1" Margin="10" Placeholder="Select String" ShowSearchBar="True"> combobox:CustomPicker.ItemsSource <x:Array xmlns:sys="clr-namespace:System;assembly=mscorlib" Type="{x:Type sys:String}"> sys:StringApple</sys:String> sys:StringBanana</sys:String> sys:StringCherry</sys:String> sys:StringDate</sys:String> sys:StringElderberry</sys:String> sys:StringFig</sys:String> sys:StringGrape</sys:String> sys:StringHoneydew</sys:String> </x:Array> </combobox:CustomPicker.ItemsSource> </combobox:CustomPicker>
new Item() { ItemCode = "1", ItemName = "Test Item", Price = 30, Quantity = 1, Discount = 0.05 }
Item is model or class and if you want to use list of (Item) it in the ComboBox, you need to set the DisplayMemberPath to the property you want to display. For example, if you want to display the ItemName, set DisplayMemberPath="ItemName".
var stringList = new ObservableCollection { "Test 1", "Test 2", "Test 3", "Test 4" }; If you use simple collection like string, int etc. you don't need to set DisplayMemberPath.
FontFamily property. The included InterMedium font is available as a resource.BackgroundColor and BorderBrushColor for the header and popup.CustomScrollBars.xaml. You can override these in your application resources.StaysOpen="False".| Property | Type | Description |
|---|---|---|
| PickerIcon | ImageSource | Set picker down icon as per choice. |
| ItemsSource | IEnumerable | The collection of items to display. |
| SelectedItem | object | The currently selected item. |
| SelectedIndex | int | The index of the selected item. |
| DisplayMemberPath | string | The property name to display for each item. |
| FontFamily | FontFamily | The font family for text. |
| FontSize | double | The font size for text. |
| BackgroundColor | Brush | The background color of the header and popup. |
| BorderBrushColor | Brush | The border color of the header and popup. |
| SelectionChanged | event | Raised when the selection changes. |
| ShowSearchBar | bool | Show textbox for search item from list. |
| Placeholder | string | Set text as placeholder For e.g.Select Item. |
| ItemTemplate | DataTemplate | Set data template as per your UI design. |
This project is licensed under the MIT License.
Contributions, issues, and feature requests are welcome! Please open an issue or submit a pull request.
Flaticon
Combo box icons created by rcherem - Flaticon
ComboBox-Wpf � The easy way to add a modern combobox to your WPF apps.