I'm having an issue with a TableView where cells become blank after scrolling through the table. This code works correctly on Xamarin.Forms 1.3.1.6296 Stable and stopped working correctly with Xamarin.Forms 1.3.2.6299-pre1. It doesn't work correctly on Xamarin.Forms 1.3.2.6316 Stable or the latest Xamarin.Forms 1.3.3.6322-pre3.
Here's the source code that you should be able to use to reproduce the issue. The cells contain a StackLayout because the layout is more complicated for those cells in the actual code. So, I can't just remove the StackLayout to fix the issue. I've also attached screenshots that show the issue. Let me know if there's something I can do to fix this.
public class App : Application
{
public App ()
{
var page = new ContentPage ();
page.Title = "Test Blank Rows";
var tableView = new TableView ();
tableView.HasUnevenRows = true;
var tableHeaderSection = new TableSection ();
var viewHeaderCell = new ViewCell ();
var headerCellLayout = new StackLayout ();
headerCellLayout.Orientation = StackOrientation.Vertical;
headerCellLayout.Spacing = 6;
headerCellLayout.HorizontalOptions = LayoutOptions.Fill;
headerCellLayout.VerticalOptions = LayoutOptions.Fill;
var largeNumberLabel = new Label ();
largeNumberLabel.FontFamily = "HelveticaNeue-Light";
largeNumberLabel.FontSize = 52;
largeNumberLabel.Text = "90";
largeNumberLabel.TextColor = Color.FromRgb(0.00392156885936856, 0.47843137383461, 0.996078431606293);
largeNumberLabel.HorizontalOptions = LayoutOptions.Center;
largeNumberLabel.VerticalOptions = LayoutOptions.Fill;
headerCellLayout.Children.Add(largeNumberLabel);
var nameLabel = new Label ();
nameLabel.FontFamily = "HelveticaNeue-Light";
nameLabel.FontSize = 17;
nameLabel.Text = "Name: John Doe";
nameLabel.HorizontalOptions = LayoutOptions.CenterAndExpand;
nameLabel.VerticalOptions = LayoutOptions.Center;
headerCellLayout.Children.Add(nameLabel);
viewHeaderCell.Height = 100;
viewHeaderCell.View = headerCellLayout;
tableHeaderSection.Add (viewHeaderCell);
tableView.Root.Add (tableHeaderSection);
for (int sectionNumber = 1; sectionNumber < 11; sectionNumber++) {
var tableSection = new TableSection ("Section #" + sectionNumber);
for (int cellNumber = 1; cellNumber < 11; cellNumber++) {
var viewCell = new ViewCell ();
var viewCellLayout = new StackLayout ();
viewCellLayout.Orientation = StackOrientation.Horizontal;
viewCellLayout.Spacing = 6;
viewCellLayout.Padding = new Thickness (20, 10);
viewCellLayout.HorizontalOptions = LayoutOptions.Center;
viewCellLayout.VerticalOptions = LayoutOptions.Center;
var titleLabel = new Label ();
titleLabel.FontFamily = "HelveticaNeue-Light";
titleLabel.FontSize = 17;
titleLabel.Text = "Cell #" + cellNumber;
viewCellLayout.Children.Add(titleLabel);
viewCell.View = viewCellLayout;
tableSection.Add (viewCell);
}
tableView.Root.Add (tableSection);
}
page.Content = tableView;
MainPage = page;
}
protected override void OnStart ()
{
// Handle when your app starts
}
protected override void OnSleep ()
{
// Handle when your app sleeps
}
protected override void OnResume ()
{
// Handle when your app resumes
}
}