MintPlayer.ObservableCollection
10.0.1
dotnet add package MintPlayer.ObservableCollection --version 10.0.1
NuGet\Install-Package MintPlayer.ObservableCollection -Version 10.0.1
<PackageReference Include="MintPlayer.ObservableCollection" Version="10.0.1" />
<PackageVersion Include="MintPlayer.ObservableCollection" Version="10.0.1" />
<PackageReference Include="MintPlayer.ObservableCollection" />
paket add MintPlayer.ObservableCollection --version 10.0.1
#r "nuget: MintPlayer.ObservableCollection, 10.0.1"
#:package MintPlayer.ObservableCollection@10.0.1
#addin nuget:?package=MintPlayer.ObservableCollection&version=10.0.1
#tool nuget:?package=MintPlayer.ObservableCollection&version=10.0.1
MintPlayer.ObservableCollection
Extended version of System.Collections.ObjectModel.ObservableCollection. This class allows you to:
- Use AddRange, invoking the CollectionChanged event only once
- Monitor properties of the items in the collection
- Be used within a WPF project
- Change the ObservableCollection from another Thread
Version info
| License | Build status |
|---|---|
| Package | Release | Preview | Downloads |
|---|---|---|---|
| MintPlayer.ObservableCollection |
Installation
NuGet package manager
Open the NuGet package manager and install the MintPlayer.ObservableCollection package in the project
Package manager console
Install-Package MintPlayer.ObservableCollection
WPF support
Xamarin.Forms is by default able to deal with Range Operations. WPF however (both .NET Framework and .NET Core) is unable to deal with Range Operations. This ObservableCollection does in fact support range operations (AddRange, RemoveRange) for WPF too.
A working example can be found in the following repository
Usage
Example 1
var collection = new ObservableCollection<string>();
collection.CollectionChanged += (sender, e) =>
{
Console.WriteLine($"Collection changed:");
if (!e.NewItems.IsNullOrEmpty())
{
var newItemsArray = new string[e.NewItems.Count];
e.NewItems.CopyTo(newItemsArray, 0);
Console.WriteLine($"- items added: {string.Join(", ", newItemsArray)}");
}
if (!e.OldItems.IsNullOrEmpty())
{
var oldItemsArray = new string[e.OldItems.Count];
e.OldItems.CopyTo(oldItemsArray, 0);
Console.WriteLine($"- items removed: {string.Join(", ", oldItemsArray)}");
}
};
collection.Add("Michael");
//collection.Enabled = false;
collection.Add("Junior");
//collection.Enabled = true;
collection.Add("Jackson");
Example 2
public class Person : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged([CallerMemberName] string propertyName = "")
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
private string firstname;
public string FirstName
{
get { return firstname; }
set
{
firstname = value;
OnPropertyChanged();
}
}
private string lastname;
public string LastName
{
get { return lastname; }
set
{
lastname = value;
OnPropertyChanged();
}
}
public string FullName => $"{firstname} {lastname}";
}
Program.cs
var collection = new ObservableCollection<Person>();
collection.CollectionChanged += (sender, e) =>
{
Console.WriteLine($"Collection changed:");
if (!e.NewItems.IsNullOrEmpty())
{
var newItemsArray = new Person[e.NewItems.Count];
e.NewItems.CopyTo(newItemsArray, 0);
Console.WriteLine($"- items added: {string.Join(", ", newItemsArray.Select(p => p.FullName))}");
}
if (!e.OldItems.IsNullOrEmpty())
{
var oldItemsArray = new Person[e.OldItems.Count];
e.OldItems.CopyTo(oldItemsArray, 0);
Console.WriteLine($"- items removed: {string.Join(", ", oldItemsArray.Select(p => p.FullName))}");
}
};
collection.ItemPropertyChanged += (sender, e) =>
{
Console.WriteLine($"Item property changed: {e.PropertyName}");
};
collection.AddRange(new[] {
new Person { FirstName = "John", LastName = "Doe" },
new Person { FirstName = "Jimmy", LastName = "Fallon" },
new Person { FirstName = "Michael", LastName = "Douglas" }
});
collection[1].LastName = "Knibble";
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
NuGet packages (3)
Showing the top 3 NuGet packages that depend on MintPlayer.ObservableCollection:
| Package | Downloads |
|---|---|
|
KarnaughMap
This package contains a .NET Core Windows Forms control that renders a Karnaugh-map which is fully interactive. |
|
|
MintPlayer.ObservableCollection.Extensions
Extension methods for MintPlayer.ObservableCollection |
|
|
MintPlayer.KarnaughMap
This package contains a .NET Core Windows Forms control that renders a Karnaugh-map which is fully interactive. |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on MintPlayer.ObservableCollection:
| Repository | Stars |
|---|---|
|
sn4k3/NetSonar
Network pings and other utilities
|
| Version | Downloads | Last Updated |
|---|---|---|
| 10.0.1 | 51 | 8/27/2026 |
| 10.0.0 | 612 | 11/11/2025 |
| 10.0.0-rc.1 | 279 | 9/19/2025 |
| 9.3.4 | 788 | 1/3/2025 |
| 9.3.3 | 266 | 1/3/2025 |
| 9.3.2 | 233 | 12/30/2024 |
| 9.3.1 | 203 | 12/30/2024 |
| 9.3.0 | 227 | 12/30/2024 |
| 9.2.0 | 229 | 12/29/2024 |
| 9.1.0 | 220 | 12/29/2024 |
| 9.0.0 | 209 | 11/13/2024 |
| 8.2.1 | 258 | 8/5/2024 |
| 8.2.0 | 251 | 2/28/2024 |
| 8.1.0 | 324 | 12/20/2023 |
| 8.0.0 | 379 | 11/14/2023 |
| 7.0.1 | 1,071 | 11/18/2022 |
| 7.0.0 | 533 | 11/17/2022 |
| 7.0.0-preview.1 | 268 | 10/31/2022 |
| 6.0.4 | 562 | 11/18/2022 |
| 6.0.3 | 568 | 10/31/2022 |