I have a RadListView which uses a ListViewTemplateCell to specify the list item layout.
When the list is displayed initially, the layout looks OK. After using pull to refresh a few times, the layout looks weird. With the example I'm attaching below, the layout is affected typically on the fourth pull to refresh. Just watch the rightmost text how it shifts to the left and right as you pull to refresh. Keep pulling for even more movement.
Telerik_UI_for_Xamarin_2018_2_516_2_Dev
Shared code project targets .NET Standard 1.4
Xamarin Forms 2.5.1.527436
Android
Android 8.1 (API Level 27 - Oreo) - on emulator
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
ContentPage
xmlns
=
"http://xamarin.com/schemas/2014/forms"
xmlns:local
=
"clr-namespace:ListBug"
xmlns:telerikDataControls
=
"clr-namespace:Telerik.XamarinForms.DataControls;assembly=Telerik.XamarinForms.DataControls"
xmlns:telerikListView
=
"clr-namespace:Telerik.XamarinForms.DataControls.ListView;assembly=Telerik.XamarinForms.DataControls"
x:Class
=
"ListBug.MainPage"
x:Name
=
"Self"
>
<
Grid
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"*"
/>
</
Grid.ColumnDefinitions
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"*"
/>
</
Grid.RowDefinitions
>
<
telerikDataControls:RadListView
x:Name
=
"listView"
ItemsSource
=
"{Binding Path=Items, Source={x:Reference Name='Self'}}"
IsPullToRefreshEnabled
=
"True"
RefreshRequested
=
"listView_RefreshRequested"
>
<
telerikDataControls:RadListView.ItemTemplate
>
<
DataTemplate
>
<
telerikListView:ListViewTemplateCell
>
<
telerikListView:ListViewTemplateCell.View
>
<
Grid
RowSpacing
=
"2"
Padding
=
"5, 0, 5, 0"
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"4*"
/>
<
ColumnDefinition
Width
=
"1*"
/>
</
Grid.ColumnDefinitions
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
Height
=
"Auto"
/>
</
Grid.RowDefinitions
>
<
Label
Text
=
"{Binding Overview}"
/>
<
Label
Grid.Row
=
"1"
Text
=
"{Binding Details}"
/>
<
Label
Grid.Column
=
"1"
Grid.RowSpan
=
"2"
Text
=
"{Binding Other}"
HorizontalTextAlignment
=
"End"
VerticalTextAlignment
=
"Center"
/>
</
Grid
>
</
telerikListView:ListViewTemplateCell.View
>
</
telerikListView:ListViewTemplateCell
>
</
DataTemplate
>
</
telerikDataControls:RadListView.ItemTemplate
>
</
telerikDataControls:RadListView
>
</
Grid
>
</
ContentPage
>
Here's the code behind:
using System.Collections.Generic;
using Xamarin.Forms;
namespace ListBug
{
public partial class MainPage : ContentPage
{
public static readonly BindableProperty ItemsProperty =
BindableProperty.Create(nameof(Items), typeof(List<
Item
>), typeof(MainPage), default(List<
Item
>), BindingMode.Default, null);
public List<
Item
> Items
{
get { return (List<
Item
>)GetValue(ItemsProperty); }
set { SetValue(ItemsProperty, value); }
}
public MainPage()
{
InitializeComponent();
InitializeItems();
}
private void InitializeItems()
{
Items?.Clear();
var items = new List<
Item
>();
items.Add(new Item()
{
Overview = "First item overview",
Details = "First item details",
Other = "Item1"
});
items.Add(new Item()
{
Overview = "Second item overview",
Details = "Second item details",
Other = "Item2"
});
items.Add(new Item()
{
Overview = "Third item overview",
Details = "Third item details",
Other = "Item3"
});
items.Add(new Item()
{
Overview = "Fourth item overview",
Details = "Fourth item details",
Other = "Item4"
});
items.Add(new Item()
{
Overview = "Fifth item overview",
Details = "Fifth item details",
Other = "Item5"
});
Items = items;
}
private void listView_RefreshRequested(object sender, Telerik.XamarinForms.DataControls.ListView.PullToRefreshRequestedEventArgs e)
{
InitializeItems();
listView.EndRefresh(true);
}
}
}
and here's the Item class
namespace ListBug
{
public class Item
{
public string Overview { get; set; }
public string Details { get; set; }
public string Other { get; set; }
}
}