adjusted project structure

This commit is contained in:
NaBian committed 2021-09-05 13:26:48 +08:00
1 parent aa7310d495
commit 904b32f986
18 files changed
+79 -212

No files matched your search

@@ -0,0 +1,58 @@
using System;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
namespace HandyControl.Collections
{
[Serializable]
public class ManualObservableCollection<T> : ObservableCollection<T>
{
private const string CountString = "Count";
private const string IndexerName = "Item[]";
private int _oldCount;
private bool _canNotify = true;
public bool CanNotify
{
get => _canNotify;
set
{
_canNotify = value;
if (value)
{
if (_oldCount != Count)
{
OnPropertyChanged(new PropertyChangedEventArgs(CountString));
}
OnPropertyChanged(new PropertyChangedEventArgs(IndexerName));
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
}
else
{
_oldCount = Count;
}
}
}
protected override void OnPropertyChanged(PropertyChangedEventArgs e)
{
if (!CanNotify) return;
base.OnPropertyChanged(e);
}
protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
{
if (!CanNotify) return;
base.OnCollectionChanged(e);
}
}
}