Make it possible to gather values using scoped ItemConfiguration
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public interface ICollectionSynchronization<TItem>;
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public static class ICollectionSynchronizationExtensions
|
||||
{
|
||||
public static int IndexOf<TItem>(this ICollectionSynchronization<TItem> synchronization,
|
||||
TItem item) => synchronization is IList<TItem> collection ? collection.IndexOf(item) : -1;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public interface IIndexable
|
||||
public interface IIndexed
|
||||
{
|
||||
public int Index { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public interface IKeyed<T>
|
||||
{
|
||||
public T Id { get; }
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public interface ISynchronizationCollection<TItem>
|
||||
{
|
||||
int IndexOf(TItem item);
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
@@ -140,4 +141,11 @@ public partial class Observable<TKey, TValue> : Observable
|
||||
Key = key;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
partial void OnValueChanged(TValue? value) => OnValueChanged();
|
||||
|
||||
protected virtual void OnValueChanged()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@ public partial class ObservableCollection<TItem> :
|
||||
IList,
|
||||
IReadOnlyList<TItem>,
|
||||
INotifyCollectionChanged,
|
||||
ISynchronizationCollection<TItem>,
|
||||
ICollectionSynchronization<TItem>,
|
||||
IServiceProviderRequired,
|
||||
IServiceFactoryRequired,
|
||||
IMediatorRequired,
|
||||
|
||||
Reference in New Issue
Block a user