[BUG] IsListNotNullOrEmptyConverter not working in android
See original GitHub issueIs there an existing issue for this?
- I have searched the existing issues
Did you read the “Reporting a bug” section on Contributing file?
- I have read the “Reporting a bug” section on Contributing file: https://github.com/CommunityToolkit/Maui/blob/main/CONTRIBUTING.md#reporting-a-bug
Current Behavior
I have an observable collection and would like to enable / disable a button when the collection is empty or has items, but the button is always disabled. I have take a look to https://github.com/CommunityToolkit/Maui/blob/main/samples/CommunityToolkit.Maui.Sample/Pages/Converters/IsListNotNullOrEmptyConverterPage.xaml but I am not able to work with the converter
Expected Behavior
the button is disabled and when I add items to the list, the button is enabled
Steps To Reproduce
Run the attached project on Android. Press “Press to add items” and the “button disabled” should become enabled
Link to public reproduction project repository
https://github.com/acaliaro/MauiAppIsListNotNullOrEmptyConverterProblem
Environment
- .NET MAUI CommunityToolkit:5.0.0
- OS:Android 10
- .NET MAUI:7
Anything else?
No response
Issue Analytics
- State:
- Created 7 months ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
[Bug] ListIsNullOrEmptyConverter doesn't respect ...
a/converters This issue/PR is related to converters ; bug Something isn't working. Breaky break. ; s/unverified This issue needs verification/ ...
Read more >IsListNotNullOrEmptyConverter - .NET MAUI Community ...
The IsListNotNullOrEmptyConverter is a one way converter that converts IEnumerable to a bool value.
Read more >Issues with Android Studio Room Type Converter
For some reason, I am having issues with the typeconverter in Android Studios. I have tried a variety of solutions from other posts,...
Read more >.NET MAUI: Android Bug - Map's MoveToRegion Method Not ...
The bug we are addressing pertains to the Map control in .NET MAUI applications on the Android platform. In some cases, the MoveToRegion...
Read more >Why does MAUI have so many bugs? : r/dotnetMAUI
I'm not done with Maui. I'm not sure these are really bugs but I've seen differences in the UI between IOS and Android...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
this works, thanks @bijington and @brminnick
Oh try this then
OnPropertyChanged(nameof(Lista));
To answer your question directed to @brminnick you don’t need to use
[ObservableProperty]
withObservableCollection
as it is a special type of collection that handles the raising of events. All other collection types likeList
will still require the use of the attribute.I believe the importance of
ObservableCollection
is not that it implementsINotifyPropertyChanged
but actuallyINotifyCollectionChanged
. This distinction helps to realise that it is firing events specific to a collection changing and therefore apply to using with controls that have anItemsSource
property.This might give a little more detail:
https://learn.microsoft.com/en-us/dotnet/api/system.collections.objectmodel.observablecollection-1?redirectedfrom=MSDN&view=net-7.0