I have a SFDataGrid which ItemSource is an observable Collection of observable objects .
In order to construct the columns i enumerate the proerties of my object and add them as you see below. I have a Property which type is of ESFIItem . if i uncomment this line an unhandled exception occurs
App_UnhandledException D:\Development\EntersoftUniversal - SFGrid\UWP\App.xaml.cs:34 System.ArgumentException An item with the same key has already been added. Key: Item ParamName=null Data=... InnerException={ }
at Xamarin.Forms.Platform.UWP.TaskExtensions.<>c.<WatchForError>b__2_1(Object e)
at System.Threading.WinRTSynchronizationContext.Invoker.InvokeCore() HelpLink=null Source=Xamarin.Forms.Platform.UAP HResult=-2147024809
MoreOver i see that the GUID columns are not getting filled with data
foreach (PropertyInfo propertyInfo in typeof(ESTMTaskItem).GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.IgnoreCase))
{
var targetType = propertyInfo.PropertyType.IsNullableType()
? Nullable.GetUnderlyingType(propertyInfo.PropertyType)
: propertyInfo.PropertyType;
if ((
targetType == typeof(DateTime) ||
targetType == typeof(DateTime?)
|| targetType == typeof(Decimal)
|| targetType == typeof(String)
|| targetType == typeof(Byte)
|| targetType == typeof(Guid?)
|| targetType == typeof(Guid)
))
{
ESDebug.Log("*********" + propertyInfo.Name + "*********");
this._DataGrid.Columns.Add(new GridTextColumn()
{
MappingName = propertyInfo.Name,
HeaderText = propertyInfo.Name,
HeaderCellTextSize = 20,
HeaderFontAttribute = FontAttributes.Bold,
HeaderTextAlignment = TextAlignment.Start,
LineBreakMode = LineBreakMode.TailTruncation
});
}
}
Attachment:
EntersoftUniversal__SFGrid__ForDeploy_bbb8b32a.rar