mirror of
https://github.com/ckaczor/Common.Wpf.git
synced 2026-01-31 09:35:37 -05:00
Initial commit
This commit is contained in:
50
CheckedListItem.cs
Normal file
50
CheckedListItem.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Common.Wpf
|
||||
{
|
||||
public class CheckedListItem<T> : INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
private bool _isChecked;
|
||||
private T _item;
|
||||
|
||||
public CheckedListItem() { }
|
||||
|
||||
public CheckedListItem(T item, bool isChecked = false)
|
||||
{
|
||||
_item = item;
|
||||
_isChecked = isChecked;
|
||||
}
|
||||
|
||||
public T Item
|
||||
{
|
||||
get
|
||||
{
|
||||
return _item;
|
||||
}
|
||||
set
|
||||
{
|
||||
_item = value;
|
||||
|
||||
if (PropertyChanged != null)
|
||||
PropertyChanged(this, new PropertyChangedEventArgs("Item"));
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsChecked
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isChecked;
|
||||
}
|
||||
set
|
||||
{
|
||||
_isChecked = value;
|
||||
|
||||
if (PropertyChanged != null)
|
||||
PropertyChanged(this, new PropertyChangedEventArgs("IsChecked"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user