UI does not update when ItemsSource changes

Hi there


I use SfRotator in my Maui App and i have bound the images to the ItemsSource and it works as expected.

View:
<rotator:SfRotator ItemsSource="{Binding ActualImages}"
                   SelectedIndex="{Binding SelectedActualImageIndex}"
                   NavigationStripPosition="Top"
                   DotsStroke="LightGray" UnselectedDotColor="LightGray" SelectedDotColor="Green">
    <rotator:SfRotator.ItemTemplate>
        <DataTemplate x:DataType="shared:ImageData">
            <Grid>
                <imageEditor:SfImageEditor Source="{Binding Data, Converter={StaticResource ByteArrayToImageSourceConverter}, Mode=OneWay}"
                                           AllowZoom="True" ShowToolbar="False"
                                           VerticalOptions="Start"/>
            </Grid>
        </DataTemplate>
    </rotator:SfRotator.ItemTemplate>
</rotator:SfRotator>

ViewModel:

public ObservableCollection<ImageData> ActualImages { get; init; }

public int SelectedActualImageIndex
{
    get => _selectedActualImageIndex;
    set
    {
        if (value == _selectedActualImageIndex) return;
        _selectedActualImageIndex = value;
        OnPropertyChanged();
    }
}

public async Task Delete()
{
    if (ActualImages.Any() && SelectedActualImageIndex > (ActualImages.Count - 1)) return;


    if (await App.Navigation.DisplayAlert("Warnung", "Bild wirklich löschen?", "Ja", "Nein"))
    {
        var idx = SelectedActualImageIndex;
        var image = ActualImages.ElementAt(idx);
        ActualImages.Remove(image);
        await _repository.DeleteAsync(image);
        if (idx > 0)
        {
            SelectedActualImageIndex = idx - 1;
        }
        else if (ActualImages.Any())
        {
            SelectedActualImageIndex = 0;
        }
    }
}

If I executethe Delete command, the image remains in the UI but its deleted from the ObserableCollection 'ActualImages'

I guess this is a bug, can you please check this? I use the latest release '29.1.38'

Regards Günter

 


2 Replies

HK Hemalatha Kondappakumareshan Syncfusion Team April 17, 2025 01:57 PM UTC

Hi Günter Rudigier,

 

Thank you for reaching out to us. We have investigated the reported query. The issue is reproducible using the code snippet you provided. We have fixed this issue, and the fix will be included in our upcoming weekly release. We will update you with further details shortly. We appreciate your support and patience until then.

 

Regards,

Hemalatha




HK Hemalatha Kondappakumareshan Syncfusion Team April 23, 2025 01:45 PM UTC

Hi Günter Rudigier,


We have included a fix for the reported issue "UI does not update when ItemsSource changes in SfRotator" in our latest weekly NuGet release, v29.1.39, which is now available for download (NuGet).


Please get in touch with us if you require any further assistance; as always, we would be happy to help you.


Regards,

Hemalatha



Loader.
Up arrow icon