I am testing the XamDataGrid and I am getting a Specified cast is not valid. when I try and sort a column by a value when the Value is Declared as Nullable, ie [?]
When I change the value to be not nullable I can then sort on that column, should you not be able to sort on Nullable POCO values? I tested with your xamdatacontrol control in Wpf, and that works just fine.
I get the following stack-trace back:
System.InvalidCastException: Specified cast is not valid.07-07 09:50:51.131 I/MonoDroid( 6266): at Infragistics.Controls.DataSource.Implementation.DataSourcePropertiesComparer.CompareValues (System.Object xValue, System.Object yValue, System.Boolean currIsDescending, Infragistics.Core.Controls.DataSource.DataSourceSchemaPropertyType schemaType) [0x00296] in E:\Work\1\1220\src\XPlatform\2017.1\Source\DataVisualization\Shared\DataSource\LocalDataSource.cs:780 07-07 09:50:51.131 I/MonoDroid( 6266): at Infragistics.Controls.DataSource.Implementation.DataSourcePropertiesComparer.Compare (System.Object x, System.Object y) [0x00048] in E:\Work\1\1220\src\XPlatform\2017.1\Source\DataVisualization\Shared\DataSource\LocalDataSource.cs:629
In detail.
public class SelectEntity2 { public int? ID { get; set; } public DateTime? NextDueDate { get; set; } }
protected override void OnAppearing() { base.OnAppearing(); if (DataGrid.ItemsSource == null) { CreateData(); DataGrid.IsVisible = true; } } private void CreateData() { var items = new List<SelectEntity2>(); for (int i = 1; i < 101; i++) { var days = new Random().Next(100); if (IsOdd(days)) items.Add(new SelectEntity2 {ID = i, NextDueDate = DateTime.Now.AddDays(days)}); else { items.Add(new SelectEntity2 { ID = i, NextDueDate = DateTime.Now.AddDays(-days) }); } } DataGrid.AutoGenerateColumns = true; DataGrid.ItemsSource = items; } public static bool IsOdd(int value) { return value % 2 != 0; }
Hello,
Thank you for contacting Infragistics. This issue was previously reported and currently under investigation.
I have created a support case for you: CAS-185436-P1F3N6 with ID 238027. You could reach your case following the link bellow:
https://es.infragistics.com/my-account/support-activity I will update you via the mentioned case, so if you have any further questions or comments please update your case.