I have the following ListView set up.
<
telerikDataControls:RadListView
x:Name
=
"PeopleListView"
BackgroundColor
=
"White"
ItemsSource
=
"{Binding Employees}"
IsItemSwipeEnabled
=
"True"
ItemSwiping
=
"PeopleListView_OnItemSwiping"
SwipeOffset
=
"160, 0, 0, 0"
SwipeThreshold
=
"10"
SelectionGesture
=
"Tap"
SelectionMode
=
"Single"
SelectionChanged
=
"PeopleListView_OnSelectionChanged"
>
<
telerikDataControls:RadListView.ItemTemplate
>
<
DataTemplate
>
<
telerikListView:ListViewTemplateCell
>
<
telerikListView:ListViewTemplateCell.View
>
<
Grid
BackgroundColor
=
"White"
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"Auto"
></
ColumnDefinition
>
<
ColumnDefinition
Width
=
"*"
></
ColumnDefinition
>
<
ColumnDefinition
Width
=
"Auto"
></
ColumnDefinition
>
</
Grid.ColumnDefinitions
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"Auto"
></
RowDefinition
>
<
RowDefinition
></
RowDefinition
>
</
Grid.RowDefinitions
>
<
Image
Source
=
"{Binding PhotoData}"
Style
=
"{StaticResource EmployeeProfileIconStyle}"
Grid.RowSpan
=
"2"
Grid.Column
=
"0"
></
Image
>
<
Label
Grid.Column
=
"1"
Grid.Row
=
"0"
Margin
=
"0,3,0,0"
FontSize
=
"Medium"
Text
=
"{Binding FullName}"
></
Label
>
<
Label
Grid.Column
=
"1"
Grid.Row
=
"1"
VerticalTextAlignment
=
"Start"
VerticalOptions
=
"Start"
Text
=
"{Binding EmployeeTitle}"
></
Label
>
<
Image
Grid.Row
=
"0"
Grid.RowSpan
=
"2"
Grid.Column
=
"2"
VerticalOptions
=
"Center"
Source
=
"ic_people_outline"
WidthRequest
=
"50"
HeightRequest
=
"50"
Opacity
=
"0.35"
IsVisible
=
"{Binding SubordinateCount, Converter={StaticResource IntToBoolConverter}}"
>
</
Image
>
</
Grid
>
</
telerikListView:ListViewTemplateCell.View
>
</
telerikListView:ListViewTemplateCell
>
</
DataTemplate
>
</
telerikDataControls:RadListView.ItemTemplate
>
<
telerikDataControls:RadListView.ItemSwipeContentTemplate
>
<
DataTemplate
>
<
Grid
Margin
=
"0"
Padding
=
"0"
ColumnSpacing
=
"0"
RowSpacing
=
"0"
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"80"
/>
<
ColumnDefinition
Width
=
"80"
/>
<
ColumnDefinition
Width
=
"*"
/>
</
Grid.ColumnDefinitions
>
<
StackLayout
Grid.Column
=
"0"
BackgroundColor
=
"#2474d2"
WidthRequest
=
"80"
>
<
StackLayout.GestureRecognizers
>
<
TapGestureRecognizer
x:Name
=
"EmailTapGestureRecognizer"
Tapped
=
"EmailTapGestureRecognizer_OnTapped"
NumberOfTapsRequired
=
"1"
></
TapGestureRecognizer
>
</
StackLayout.GestureRecognizers
>
<
Image
Source
=
"ic_mail_outline"
VerticalOptions
=
"CenterAndExpand"
></
Image
>
</
StackLayout
>
<
StackLayout
Grid.Column
=
"1"
BackgroundColor
=
"LimeGreen"
WidthRequest
=
"80"
>
<
StackLayout.GestureRecognizers
>
<
TapGestureRecognizer
x:Name
=
"CallTapGestureRecognizer"
Tapped
=
"CallTapGestureRecognizer_OnTapped"
NumberOfTapsRequired
=
"1"
></
TapGestureRecognizer
>
</
StackLayout.GestureRecognizers
>
<
Image
Source
=
"ic_call"
VerticalOptions
=
"CenterAndExpand"
></
Image
>
</
StackLayout
>
</
Grid
>
</
DataTemplate
>
</
telerikDataControls:RadListView.ItemSwipeContentTemplate
>
</
telerikDataControls:RadListView
>
The model that is bound to ListView is as follows.
public class Employee
{
public int EmployeeId { get; set; }
public int SubordinateCount { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string EmailAddress { get; set; }
public string EmployeeTitle { get; set; }
public string FullName => $"{FirstName} {LastName}";
public ImageSource PhotoData { get; set; }
// ...
}
The PhotoData property is ImageSource type and is obtained from base64 of the image as follows (this all happens before being bound to View).
var imageData = Convert.FromBase64String(GetEmployeePhotoData());
employee.PhotoData = ImageSource.FromStream(() =>
new
MemoryStream(imageData));
And Employees (ListView's ItemsSource) is an ObservableCollection<Employee> property in ViewModel.
When I display a list of employees in a ListView everything works fine on Android. However, on iOS the employee photos flicker for 1 - 2 seconds when ListView is displayed. To be precise, it's not flickering, but rather photos change quickly before stabilizing. For example, if I have employees A, B and C in ListView, then on load I see that employee A has employee C's photo for split second, then it quickly changes to employee B's photo. Then it changes again, so that employee A has correct employee A's photo displayed. The similar thing happens for all employees in the list. (The order in which photos "flicker" may or may not be sequential - the order in which people are displayed in the list - because they change so quickly it's hard to tell. But eventually, when "flickering" stops, all employees have correct photos displayed.)
Please let me know what can be done to solve this.
Thanks