ListView with triggers doesn't update well

Hello,

I use a SfListView component, which use some Xamarin Triggers on some of his DataTemplate's child.
I've noticed that with a short list (when all the list's items are on screen), triggers works perfectly.
But on a long list (longer than the screen), when I scroll up/down, the triggers are not updated well and shows incorrect behaviour.

Do you have any idea why ?

Thanks, have a nice day.

5 Replies

RS Rawoof Sharief Muthuja Sherif Syncfusion Team May 10, 2018 11:13 AM UTC

Hi Thomas, 
 
We have checked the reported query “ListView with triggers doesn't update properly when scroll the items” from our end with our sample. In our sample we have loaded the label inside the item template of the SfListView and add triggers for the label. Unfortunately, the reported issue does not replicate at our end. ListView items are loaded in the view as expected. 
 
We have attached the sample for your reference and you can download it from the below link.  
  
 
Can you please check whether the reported issue occurs in our sample also? If possible, can you please modify our sample to replicate the reported issue in our sample which would highly help us to analyze the query better.  
 
Note: If you write triggers for the input element like Entry then you need to handle the focus for it. 
  
Regards,  
Rawoof M.  
 



RI Ricky September 10, 2018 01:20 PM UTC

Hi, I have experienced the same problem. I'm attaching a sample based on your attached solution you provided.

It seems colours are fine, but if the text is changing on a DataTrigger it just disappears.

The attached has a XAML file where it currently uses the standard ListView, you'll see as you scroll the overridden text which is replaced with the DataTrigger remains.

If you then uncomment your SfListView and comment out ListView, you'll see the overridden text disappears as you scroll, this showing different results using DataTriggers between ListView and SfListView with ListView behaving correctly.

File was too big to attach, so the attached .zip is the original Grouping folder, leaving .Droid .iOS and .UWP alone.

Attachment: Grouping_a62442ff.zip


RI Ricky September 10, 2018 01:21 PM UTC

If you have problems with the .zip, ultimately, the below XAML demonstrates the issue:

    <listView:SfListView x:Name="listView"  ItemsSource="{Binding contactsinfo}">
     
        <listView:SfListView.ItemTemplate>
            <DataTemplate>
                <ViewCell>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />                       
                            </Grid.ColumnDefinitions>
                        <Label>
                            <Label.Triggers>
                                <DataTrigger TargetType="Label" Binding="{Binding Favorite}" Value="true">
                                    <Setter Property="Text" Value="This disappears on scroll" />
                                    <Setter Property="TextColor" Value="Red" />
                                </DataTrigger>
                                <DataTrigger TargetType="Label"
                                                     Binding="{Binding Favorite}" Value="False">
                                    <Setter Property="TextColor" Value="Purple" />
                                    <Setter Property="Text" Value="{Binding ContactName}" />
                                </DataTrigger>
                            </Label.Triggers>
                        </Label>
                    </Grid>
                </ViewCell>
            </DataTemplate>
        </listView:SfListView.ItemTemplate>

    </listView:SfListView>

    <!--<ListView ItemsSource="{Binding contactsinfo}">

        <ListView.ItemTemplate>
            <DataTemplate>
                <ViewCell>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <Label>
                            <Label.Triggers>
                                <DataTrigger TargetType="Label" Binding="{Binding Favorite}" Value="true">
                                    <Setter Property="Text" Value="This does NOT disappear on scroll" />
                                </DataTrigger>
                                <DataTrigger TargetType="Label"
                                             Binding="{Binding Favorite}" Value="False">
                                    <Setter Property="TextColor" Value="Purple" />
                                    <Setter Property="Text" Value="{Binding ContactName}" />
                                </DataTrigger>
                            </Label.Triggers>
                        </Label>
                    </Grid>
                </ViewCell>
            </DataTemplate>
        </ListView.ItemTemplate>

    </ListView>-->


JN Jayaleshwari N Syncfusion Team September 11, 2018 11:04 AM UTC

Hi Ricky,  
 
Sorry for the inconvenience.     
    
We have confirmed that the issue “ListView with triggers does not update properly” is a defect and we have logged a defect report. The fix will be available in our 2018 Vol 3 SP1 which is scheduled to be roll out by the end of October month. We will appreciate your patience until then.    
 
Regards,  
Jayaleshwari N 



LN Lakshmi Natarajan Syncfusion Team December 30, 2020 09:57 AM UTC

Hi Thomas, Ricky, 
 
 We would like to inform you that the reported issue is the framework issue and we have logged the bug report for the same. Kindly refer the following report from below for further updates. 
  
 
Regards, 
Lakshmi Natarajan 


Loader.
Up arrow icon