Hi,
I am having issues with a rating control nested inside a ListViewTemplateCell. The rating value (number of filled items) mismatches with the underlying bound value. The strange thing is that the initial rendered list is ok, but as soon as i start scrolling down the new appearing cells show the described problem. See the attached image. The rating value property is bound to an ObservableCollection<OBJ> via MVVM. I tried int and double, but no difference.
Any ideas?
Here is my XAML test snippet:
01.
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
02.
<
ContentPage
03.
x:Class
=
"PortaalApp.Views.IncidentListPage"
xmlns
=
"http://xamarin.com/schemas/2014/forms"
04.
xmlns:x
=
"http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:converters
=
"clr-namespace:PortaalApp.Converters"
05.
xmlns:i18n
=
"clr-namespace:PortaalApp.I18n"
xmlns:prism
=
"clr-namespace:Prism.Mvvm;assembly=Prism.Forms"
06.
xmlns:prismBehaviors
=
"clr-namespace:Prism.Behaviors;assembly=Prism.Forms"
xmlns:rating
=
"clr-namespace:Telerik.XamarinForms.Input;assembly=Telerik.XamarinForms.Input"
07.
xmlns:telerikDataControls
=
"clr-namespace:Telerik.XamarinForms.DataControls;assembly=Telerik.XamarinForms.DataControls"
xmlns:telerikListView
=
"clr-namespace:Telerik.XamarinForms.DataControls.ListView;assembly=Telerik.XamarinForms.DataControls"
08.
xmlns:telerikPrimitives
=
"clr-namespace:Telerik.XamarinForms.Primitives;assembly=Telerik.XamarinForms.Primitives"
xmlns:views
=
"clr-namespace:PortaalApp.Views"
09.
x:Name
=
"this"
prism:ViewModelLocator.AutowireViewModel
=
"True"
>
10.
11.
<
telerikDataControls:RadListView
x:Name
=
"listView"
ItemsSource
=
"{Binding ListSource}"
>
12.
13.
<
telerikDataControls:RadListView.ItemTemplate
>
14.
<
DataTemplate
>
15.
<
telerikListView:ListViewTemplateCell
>
16.
<
telerikListView:ListViewTemplateCell.View
>
17.
<
StackLayout
Orientation
=
"Horizontal"
>
18.
<
rating:RadShapeRating
19.
x:Name
=
"inzetRating"
20.
ItemShape
=
"{x:Static rating:Geometries.Circle}"
21.
Value
=
"{Binding InzetIndex}"
/>
22.
<
Label
Text
=
"{Binding InzetIndex, StringFormat='{0}'}"
/>
23.
</
StackLayout
>
24.
</
telerikListView:ListViewTemplateCell.View
>
25.
</
telerikListView:ListViewTemplateCell
>
26.
</
DataTemplate
>
27.
</
telerikDataControls:RadListView.ItemTemplate
>
28.
</
telerikDataControls:RadListView
>
29.
</
ContentPage
>
The underlying bound object:
[System.CodeDom.Compiler.GeneratedCode(
"NJsonSchema"
,
"9.10.6.0 (Newtonsoft.Json v9.0.0.0)"
)]
public
partial
class
OBJ_Result
{
public
int
InzetIndex
{
get
{
if
(A)
return
3;
else
if
(B)
return
2;
else
if
(C)
return
1;
else
return
0;
}
}
[Newtonsoft.Json.JsonProperty(
"C"
, Required = Newtonsoft.Json.Required.Always)]
public
bool
C {
get
;
set
; }
[Newtonsoft.Json.JsonProperty(
"B"
, Required = Newtonsoft.Json.Required.Always)]
public
bool
B {
get
;
set
; }
[Newtonsoft.Json.JsonProperty(
"A"
, Required = Newtonsoft.Json.Required.Always)]
public
bool
A {
get
;
set
; }
public
string
ToJson()
{
return
Newtonsoft.Json.JsonConvert.SerializeObject(
this
);
}
public
static
OBJ FromJson(
string
data)
{
return
Newtonsoft.Json.JsonConvert.DeserializeObject<OBJ>(data);
}
}