Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CollectionView with RemainingItemsThresholdReachedCommand does not like RelayCommand bound methods #1037

Open
1 of 4 tasks
JustRed23 opened this issue Jan 3, 2025 · 0 comments
Labels
bug 🐛 An unexpected issue that highlights incorrect behavior

Comments

@JustRed23
Copy link

Describe the bug

When making an async method and annotate it with the RelayCommand attribute, assigning it to the RemainingItemsThresholdReachedCommand will generate some weirdness, the method will only rarely execute correctly. But when I create an AsyncRelayCommand myself and remove the RelayCommand attribute, everything works as expected

Regression

No response

Steps to reproduce

  1. Create a CollectionView with the RemainingItemsThresholdReachedCommand event and some items, so you can get to the threshold
    Example:
    <CollectionView RemainingItemsThreshold="1" RemainingItemsThresholdReachedCommand="{Binding MyAsyncFunctionCommand}">

  2. Create the function
    Example:

[RelayCommand]
private async Task MyAsyncFunction()
{
    await Task.Delay(2000);
    Debug.WriteLine("Hello, world!");
}
  1. Observe that the function does not fire correctly

Expected behavior

Whenever the collectionview reaches its end, the event gets fired normally

Screenshots

No response

IDE and version

Rider

IDE version

JetBrains Rider 2024.3

Nuget packages

  • CommunityToolkit.Common
  • CommunityToolkit.Diagnostics
  • CommunityToolkit.HighPerformance
  • CommunityToolkit.Mvvm (aka MVVM Toolkit)

Nuget package version(s)

8.4.0

Additional context

No response

Help us help you

No, just wanted to report this

@JustRed23 JustRed23 added the bug 🐛 An unexpected issue that highlights incorrect behavior label Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An unexpected issue that highlights incorrect behavior
Projects
None yet
Development

No branches or pull requests

1 participant