using System.Data;
using System;
namespace Tabular.Mobile.ViewModels
{
class ItemsVM : VMBase
{
private DataTable _testTable = new DataTable();
public DataTable TestTable { get => _testTable; set => _testTable = value; }
public ItemsVM()
{
_testTable.Columns.Add("ItemNumber", typeof(int));
_testTable.Columns.Add("ItemName", typeof(string));
_testTable.Columns.Add("ItemString1", typeof(string));
_testTable.Columns.Add("ItemString2", typeof(string));
_testTable.Columns.Add("ItemString3", typeof(string));
_testTable.Columns.Add("ItemString4", typeof(string));
_testTable.Columns.Add("ItemString5", typeof(string));
_testTable.Columns.Add("ItemDateTime", typeof(DateTime));
_testTable.Rows.Add(1, "Item 1", "String11", "String12", "String13", "String14", "String15", DateTime.Now);
_testTable.Rows.Add(2, "Item 2", "String12", "String22", "String23", "String24", "String25", DateTime.Now);
_testTable.Rows.Add(3, "Item 3", "String13", "String32", "String33", "String34", "String35", DateTime.Now);
_testTable.Rows.Add(4, "Item 4", "String14", "String42", "String43", "String44", "String45", DateTime.Now);
_testTable.Rows.Add(5, "Item 5", "String15", "String52", "String53", "String54", "String55", DateTime.Now);
_testTable.Rows.Add(6, "Item 6", "String16", "String62", "String63", "String64", "String65", DateTime.Now);
_testTable.Rows.Add(7, "Item 7", "String17", "String72", "String73", "String74", "String75", DateTime.Now);
_testTable.Rows.Add(8, "Item 8", "String18", "String82", "String83", "String84", "String85", DateTime.Now);
_testTable.Rows.Add(9, "Item 9", "String19", "String92", "String93", "String94", "String95", DateTime.Now);
_testTable.Rows.Add(10, "Item 10", "String101", "String102", "String103", "String104", "String105", DateTime.Now);
}
}
}
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="using:Tabular.Mobile.ViewModels"
xmlns:grid="clr-namespace:Syncfusion.SfDataGrid.XForms;assembly=Syncfusion.SfDataGrid.XForms"
xmlns:rating="clr-namespace:Syncfusion.SfRating.XForms;assembly=Syncfusion.SfRating.XForms"
mc:Ignorable="d"
x:Class="Tabular.Mobile.Views.ItemsListPage">
<ContentPage.Content>
<StackLayout Orientation="Vertical">
<StackLayout.BindingContext>
<vm:ItemsVM />
</StackLayout.BindingContext>
<grid:SfDataGrid x:Name="sfGrid"
ColumnSizer="Auto"
AllowEditing="False"
NavigationMode="Cell"
ItemsSource="{Binding TestTable}"
AutoGenerateColumns="True"
AllowPullToRefresh="False">
<grid:SfDataGrid.Columns>
<grid:GridTemplateColumn HeaderText="Rating"
MappingName="ItemNumber"
Width="210">
<grid:GridTemplateColumn.CellTemplate>
<DataTemplate>
<StackLayout>
<rating:SfRating Value="{Binding [0]}"
ItemCount="10"
ItemSize="15"
IsEnabled="False" />
</StackLayout>
</DataTemplate>
</grid:GridTemplateColumn.CellTemplate>
</grid:GridTemplateColumn>
</grid:SfDataGrid.Columns>
</grid:SfDataGrid>
</StackLayout>
</ContentPage.Content>
</ContentPage>
It seems to be related to the rendering of the sfRating control. As I mentioned, it only happens when the binding is set on the Value property of the sfRating control. Do you know what could be happening?