-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[Android] CollectionView and other control's visibility do not update from Binding #8135
Comments
Also relates maybe to #7747 |
Does it help if you wrap it in a call to run this code on the main thread? |
Hi @Hottemax. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
if it helps, issue that has occurred since version 6.0.400. |
Hi Gerald, I have tried all kinds of Thread magic to get it to work (using AsyncCommand, Task.Delay, ConfigureAwait(false), Device.BeginInvokeOnMainThread(), and a great number of random combinations of these, but nothing yielded any results. I feel that this should really be high priority, as CollectionView not updating is kind of a deal-breaker. |
Update for platforms:
So it really seems to be Android-specific |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Another update: I don't want to open another ticket for this, so I will add it here, maybe the collectionview tag needs to be removed as the issue seems more general: The same behavior of UI not updating can be observed when updating other visual elements from a Binding. Observed Behavior: Expected Behavior: <Label
HorizontalOptions="Center"
IsVisible="{Binding IsBusy}"
Text="I am only showing for 3 seconds when ShowBusyCommand runs" />
<ActivityIndicator
HeightRequest="40"
HorizontalOptions="FillAndExpand"
IsEnabled="{Binding IsBusy}"
IsRunning="{Binding IsBusy}"
IsVisible="{Binding IsBusy}" />
<Button
Command="{Binding ShowBusyCommand}"
HorizontalOptions="Center"
Text="Show Activity" /> public bool IsBusy { get; set; } = false;
public ICommand ShowBusyCommand => new AsyncCommand(ShowBusyIndicator);
async Task ShowBusyIndicator()
{
// Label and ActivityIndicator will only appear on iOS and Windows, not Android
IsBusy = true;
OnPropertyChanged(nameof(IsBusy));
await Task.Delay(3000);
IsBusy = false;
OnPropertyChanged(nameof(IsBusy));
} |
This comment was marked as off-topic.
This comment was marked as off-topic.
Does seriously a Microsoft employee ask a customer to fix a bug in a Microsoft framework (sounding like it's the customer's responsibility to get it fixed)? |
Description
The Content of a
CollectionView
bound to a property viaDataTemplate
will only update when the user interacts with theCollectionView
control via a drag gesture. It does not refresh the UI itself viaOnPropertyChanged(nameof(BoundProperty))
.Code snippets (reproducible from attached zip)
Test project:
Steps to Reproduce
Open the provided TestApp.zip
(edited to include the issue described in #8135 (comment))
TestApp.zip
Click the "Update Icons" button.
It will show that the Items list has been updated.
The UI of the CollectionView will only refresh to show the added items when performing a Drag Gesture (i.e. Click in the CollectionView area below the Label, and drag).
Version with bug
6.0.400 (current)
Last version that worked well
Unknown/Other
Affected platforms
Android, I was not able test on other platforms
Affected platform versions
Android API 30, 31
Did you find any workaround?
No response
Relevant log output
No response
The text was updated successfully, but these errors were encountered: