when double clicking to create a new row, an exception gets raised:
an unhandled exception of type 'System.NullReferenceException' occurred in DynamicProxyGenAssembly2
am using SfDataGrid with ItemsSource bound to a tracked collection of type Castle.Proxies.ItemProxy which is generated by this widely used ChangeTracking library which is based on Castle DynamicProxy
the weird thing is, the problem doesn't happen when i use the default WPF DataGrid control, it only happens when i use the SfDataGrid control?
So is there any way to solve this? How can i use SfDataGrid along with Proxy objects?
Attachment: WpfApp1_fd2415ca.zip
|
private void SfDataGrid_AddNewRowInitiating(object sender, AddNewRowInitiatingEventArgs e)
{
e.NewObject = new Item() { Name = " " };
}
|
thanks for your reply!
but now if you try and edit any newly added row field you get an exception:
An unhandled exception of type 'System.InvalidCastException' occurred in System.Private.CoreLib.dll
Unable to cast object of type 'WpfApp1.Item' to type 'Castle.Proxies.ItemProxy'.
am sorry to inform you but the exception does clearly happen when you edit a new row field and just to be precise, it happens exactly at the moment you finish editing a field THEN click away to another row using the mouse?
if you press tab when you finish the exception doesn't happen???
Hi Joseph,
We are checking the reported issue. We will update you with more details on March 1, 2022.
Regards,
Sampath Narayanan.S
OK it seems the problem gets actually fixed by setting the SfDataGrid.SourceType just like you said.
am sorry for the inconvenience, I just wasn't paying attention enough!
you saved the day, Big Thanks To YOU!
Hi Joseph,
We are glad to know that the reported problem has been resolved at your end. Please let us know if you have any further queries on this. We are happy to help you😊.
Regards,
Sampath Narayanan.S