What does this DataGrid error mean: System.Windows.Data Error: 39 : BindingExpression path error:?

Feb 24, 2009 at 3:11 PM
System.Windows.Data Error: 39 : BindingExpression path error: 'FirstName' property not found on 'object' ''Object' (HashCode=6503226)'. BindingExpression:Path=FirstName; DataItem='Object' (HashCode=6503226); target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String')

I get this error message logged to the output window at run time.  I can't see anything wrong with the runtime behavior.  Everything seems to be working fine with the DataGrid.  Is this just an internal exception that gets handled automatically, but logged when the       AutoGenerateColumns="True" is used?
Coordinator
Feb 24, 2009 at 7:12 PM
This looks to be the binding on the new row.  This is an affect of the new row being of type object.  If you don't need the new row you can set CanUserAddRows to false and you shouldn't see this binding error.
Feb 24, 2009 at 7:33 PM
Could be since it only happens once.  Though the collection I am binding to the datagrid itemssource is an ObservableCollection<Person>.  Perhaps when it first makes the extra row, that row isn't associated with any Person yet and that is what the error is about.

It is just in the output window, so maybe I just shouldn't worry about it.  Everything else seems to be going fine with it now.

I WANT that extra row.  It's taken me about a week to figure out how to make it BE THERE :-)  (Just starting with .Net, DataGrid, Delphi Prism and Eco 5.  Lots to learn)  It took me a while to figure out what I had to do so that CanUserAddRows wasn't changed from the True that was in the Xaml to False that it had at runtime.  Now I've got it figured out.

Except for that runtime output message that was worrying me.

If you have something to do about it, maybe you can make it so that if the binding can't be done on the "extra row", it should just ignore it because that is okay.
Feb 24, 2009 at 8:10 PM
do you have any sorting or similar?
Feb 24, 2009 at 8:34 PM
snovik,

   Not sure what you mean.  For the error?  No the error comes out as soon as the form is displayed.  For the DataGrid?  Yes, I can click on the column headers and sorting happens (which I am very pleased with because I think that was an issue with prior Eco versions)
Feb 25, 2009 at 7:25 AM
I had a similar error on a collectio with manual sorting which was sorted on a non-existent property
May 14, 2009 at 9:22 PM

This is just because of the new row and I don't know why this row is expected as type of Object. Object type does not have 'FirstName' property of course. I think framework is smart enough to know the exactly type of items and please fix this annoying bug.

Jun 19, 2009 at 6:58 PM

I agree with firedog067 - it doesn't make sense to let this error bubble up since by default the "new row" is enabled! Please fix it.