Skip to content

Instantly share code, notes, and snippets.

@lisardggY
Created September 28, 2016 12:50
Show Gist options
  • Save lisardggY/bff0c227b770d437eb6914fd2d91089c to your computer and use it in GitHub Desktop.
Save lisardggY/bff0c227b770d437eb6914fd2d91089c to your computer and use it in GitHub Desktop.
Selectable view model
public class Selectable<T> : ViewModelBase
{
private bool _isSelected;
public Selectable(T item)
{
Item = item;
IsSelected = false;
}
public T Item { get; private set; }
public bool IsSelected
{
get { return _isSelected; }
set
{
if (Equals(_isSelected, value))
{
return;
}
_isSelected = value;
OnPropertyChanged(() => IsSelected);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment