using System; using System.ComponentModel; namespace SearchableSelectableVirtualList { public class Employee : ISelectable, INotifyPropertyChanged { private string _name; public Employee() { IsSelected = false; HasRemoved = false; } public string Name { get { return _name; } set { _name = value; OnPropertyChanged("Name"); } } private bool _isSelected; public bool IsSelected { get { return _isSelected; } set { _isSelected = value; OnPropertyChanged("IsSelected"); } } private bool _hasRemoved; public bool HasRemoved { get { return _hasRemoved; } set { _hasRemoved = value; OnPropertyChanged("HasRemoved"); } } public override bool Equals(object obj) { var employee = obj as Employee; if (employee == null) return false; return employee.Name == Name; } public override int GetHashCode() { return base.GetHashCode() + Name.GetHashCode(); } public event PropertyChangedEventHandler PropertyChanged; public void OnPropertyChanged(string name) { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { handler(this, new PropertyChangedEventArgs(name)); } } } }
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)