MainWindow.xaml.cs: using System; using System.Collections.ObjectModel; using System.ComponentModel; using System.Windows; using System.Windows.Input; namespace ComboboxItemWithButton { public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } } public class ViewModel : INotifyPropertyChanged { public ViewModel() { for(int i = 0; i < 5; i++) { books.Add(new BookEntry( $"BOOK{i}", "Visible")); } } private ICommand _myCommand; public ICommand MyCommand => _myCommand ?? (_myCommand = new RelayCommand(parameter => { if (parameter is BookEntry v) { Books.Remove(v); MessageBox.Show(Books.Count.ToString()); } })); private ObservableCollection books = new ObservableCollection(); public ObservableCollection Books { get { return books; } set { books = value; OnPropertyChanged("Books"); } } private BookEntry selectedItem ; public BookEntry SelectedItem { get { return selectedItem; } set { if (selectedItem == value) return; selectedItem = value; selectedItem.ISShow = "Hidden"; OnPropertyChanged("SelectedItem"); } } private void OnPropertyChanged(string propertyName) { if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } public event PropertyChangedEventHandler PropertyChanged; } public class RelayCommand : ICommand { private Action execute; private Func canExecute; public event EventHandler CanExecuteChanged { add { CommandManager.RequerySuggested += value; } remove { CommandManager.RequerySuggested -= value; } } public RelayCommand(Action execute, Func canExecute = null) { this.execute = execute; this.canExecute = canExecute; } public bool CanExecute(object parameter) { return this.canExecute == null || this.canExecute(parameter); } public void Execute(object parameter) { this.execute(parameter); } } public class BookEntry { public string Name { get; set; } public string ISShow { get; set; } public BookEntry() { } public BookEntry(string name, string show) { Name = name; ISShow = show; } public override string ToString() { return Name; } } }