xamarin/Xamarin.Forms

TableView animating incorrectly when updating TableSection/TextCell

Open

#5,198 opened on Feb 11, 2019

 (3 comments) (0 reactions) (0 assignees)C# (1,926 forks)batch import
a/listviewe/4 :clock4:help wantedinactivep/UWPt/bug :bug:up-for-grabs

Repository metrics

Stars
 (5,644 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Description

While UWP is not affected by the issue #5197, it animates incorrectly in the case we replaced the default TableRoot by our own.

Steps to Reproduce

  1. Create a new Xamarin.Forms project
  2. Set the following content in MainPage.xaml
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:TableViewAnimationIssue"
             x:Class="TableViewAnimationIssue.MainPage">

    <StackLayout Padding="10">
        <Label Text="Bad" />
        <TableView x:Name="TableViewBad" Intent="Form" />
        <Label Text="Good" />
        <TableView x:Name="TableViewGood" Intent="Form" />
        <Button x:Name="Increment" Text="Increment" />
    </StackLayout>

</ContentPage>
  1. Set the following in MainPage.xaml.cs
using System;
using Xamarin.Forms;

namespace TableViewAnimationIssue
{
    public partial class MainPage : ContentPage
    {
        public int _count = 0;
        private TableSection _sectionBad;
        private TableSection _sectionGood;
        private TextCell _cellBad;
        private TextCell _cellGood;

        public MainPage()
        {
            InitializeComponent();

            _sectionBad = new TableSection("0");
            _sectionGood = new TableSection("0");
            _cellBad = new TextCell { Text = "0" };
            _cellGood = new TextCell { Text = "0" };

            var sectionBad2 = new TableSection("Text");
            var cellBad2 = new TextCell { Text = "Text" };
            var sectionGood2 = new TableSection("Text");
            var cellGood2 = new TextCell { Text = "Text" };

            _sectionBad.Add(_cellBad);
            sectionBad2.Add(cellBad2);
            TableViewBad.Root = new TableRoot { _sectionBad, sectionBad2 };

            _sectionGood.Add(_cellGood);
            sectionGood2.Add(cellGood2);
            TableViewGood.Root.Add(_sectionGood);
            TableViewGood.Root.Add(sectionGood2);

            Increment.Clicked += Increment_Clicked;
        }

        private void Increment_Clicked(object sender, EventArgs e)
        {
            _count++;

            _sectionBad.Title = _count.ToString();
            _sectionGood.Title = _count.ToString();

            _cellBad.Text = _count.ToString();
            _cellGood.Text = _count.ToString();
        }
    }
}

Expected Behavior

The UI updates without playing an entrance animation on the whole TableView.

Actual Behavior

The UI updates and plays an entrance animation on the whole TableView.

Basic Information

  • Version with issue: At least 3.4.0.1008975, up to 3.5.0.129452
  • Platform Target Frameworks: UWP (others are currently impacted by issue #5197 which prevents this issue)
    • UWP: 16299

Screenshots

tablesectionuwpissue

Reproduction Link

https://github.com/TimLariviere/XFIssueRepros/tree/master/TableViewAnimationIssue

Contributor guide