Hey guys,
I am currently implementing the Telerik Listview into my Xamarin Forms application.
But I am running into a strange behaviour on iOS. Am using the following IValueConverter
public
class
ByteArrayToImageConverter : IValueConverter
{
public
object
Convert(
object
value, Type targetType,
object
parameter, System.Globalization.CultureInfo culture)
{
if
(value !=
null
)
{
return
ImageSource.FromStream(() =>
new
MemoryStream((
byte
[])value));
}
return
null
;
}
public
object
ConvertBack(
object
value, Type targetType,
object
parameter, System.Globalization.CultureInfo culture)
{
throw
new
NotImplementedException();
}
}
My Listview looks like this:
<
telerikDataControls:RadListView
x:Name
=
"LVUser "
Grid.Column
=
"0"
Grid.Row
=
"0"
>
<
telerikDataControls:RadListView.LayoutDefinition
>
<
telerikListView:ListViewLinearLayout
ItemLength
=
"60"
/>
</
telerikDataControls:RadListView.LayoutDefinition
>
<
telerikDataControls:RadListView.GroupHeaderTemplate
>
<
DataTemplate
>
<
ContentView
Style
=
"{StaticResource GroupingHeaderBar}"
>
<
Label
Text
=
"{Binding }"
Style
=
"{StaticResource GroupingHeaderLabel}"
/>
</
ContentView
>
</
DataTemplate
>
</
telerikDataControls:RadListView.GroupHeaderTemplate
>
<
telerikDataControls:RadListView.ItemTemplate
>
<
DataTemplate
>
<
telerikListView:ListViewTemplateCell
>
<
telerikListView:ListViewTemplateCell.View
>
<
Grid
Padding
=
"5,1,0,1"
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"48"
/>
<
ColumnDefinition
Width
=
"*"
/>
<
ColumnDefinition
Width
=
"10"
/>
</
Grid.ColumnDefinitions
>
<
ffimageloading:CachedImage
Grid.Column
=
"0"
HeightRequest
=
"48"
WidthRequest
=
"48"
x:Name
=
"Picture"
Source
=
"{Binding Picture, Converter={StaticResource ByteToImage}}"
HorizontalOptions
=
"Start"
/>
<
Label
Text
=
"{Binding Id, Converter={StaticResource NameConverter}}"
Style
=
"{StaticResource MainLabel}"
Grid.Column
=
"1"
VerticalOptions
=
"CenterAndExpand"
/>
<
FontAwesome:FontAwesomeIcon
x:Name
=
"LblMore"
Text
=
"ï„…"
Grid.Column
=
"2"
Style
=
"{StaticResource MainLabel}"
VerticalOptions
=
"CenterAndExpand"
HorizontalOptions
=
"EndAndExpand"
/>
</
Grid
>
</
telerikListView:ListViewTemplateCell.View
>
</
telerikListView:ListViewTemplateCell
>
</
DataTemplate
>
</
telerikDataControls:RadListView.ItemTemplate
>
</
telerikDataControls:RadListView
>
This runs perfectly on Android but on iOS the value converter get's called unlimited times. I am using the current stable nuget package.
The "NameConverter" get's called as often as the other one.
Can't I use IValueConverter's?
Best regards
Julian