question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Proposal] ObservableRangeCollection

See original GitHub issue

ObservableRangeCollection

  • Proposed
  • Prototype: Not Started
  • Implementation: Not Started
    • iOS Support
    • Android Support
    • macOS Support
    • Windows Support
  • Unit Tests: Not Started
  • Sample: Not Started
  • Documentation: Not Started

Summary

Represents a dynamic data collection that provides notifications when items get added, removed, or when the whole list is refreshed

Detailed Design

public class ObservableRangeCollection<T> : ObservableCollection<T>
{
  public ObservableRangeCollection() : base()
  {
  }

  public ObservableRangeCollection(IEnumerable<T> collection) : base(collection)
  {
  }

  public void AddRange(IEnumerable<T> collection, NotifyCollectionChangedAction notificationMode = NotifyCollectionChangedAction.Add);

  public void RemoveRange(IEnumerable<T> collection, NotifyCollectionChangedAction notificationMode = NotifyCollectionChangedAction.Reset);

  public void Replace(T item);

  public void ReplaceRange(IEnumerable<T> collection);
}

Usage Syntax

XAML Usage

N/A

C# Usage

public ObservableRangeCollection<int> collection = new();

public void AddNumbers(int count)
{
  var startingNumber = collection.Length;
  collection.AddRange(Enumerable.Range(startingNumber, count));
}

Drawbacks

We are deferring all MVVM components to the MVVM Toolkit, keeping the .NET MAUI Community Toolkit focused on .NET MAUI-specific tools.

Alternatives

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
brminnickcommented, May 5, 2022

Agreed.

There are efforts being made internally to still sneak it into .NET 7.

But if it were to be added to a Community Toolkit, then https://github.com/CommunityToolkit/dotnet would be the best toolkit for it.

2reactions
pictoscommented, Oct 8, 2022

@kkppstudios you can copy the implementation to your code and use it there

Read more comments on GitHub >

github_iconTop Results From Across the Web

ObservableRangeCollection<T> Class
Represents a dynamic data collection that provides notifications when items get added, removed, or when the whole list is refreshed.
Read more >
ObservableCollection and Item PropertyChanged
If I have an observable collection that is a collection of "PersonNames" as in the msdn example (http: //msdn.microsoft.com/en-us/library/ ...
Read more >
Observable Collection | WPF Controls
The SchedulerViewModel class exposes the generic collections of these objects (the ObservableCollection<ModelAppointment> and the ObservableCollection< ...
Read more >
Infinite Scrolling with Incremental Data Loading in Xamarin. ...
CollectionView has the built-in ability to fetch additional data when the user scrolls through the content already loaded.
Read more >
ListView binding to ObservableCollection does not update ...
When my task returns with the collection i add them to the observable collection but this does not update the UI for some...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found