When ItemsSource is an empty list, no "extra row"

Feb 24, 2009 at 9:37 PM
When the DataGrid is bound to an ObservableCollection that has no members, I got no "extra row" to add new instances.

I''m not TOTALLY sure that my Eco data when there are no instances is giving something that DataGrid can understand, but I suspect it is.

Anyone else have no "initial extra row" when there is no data in the table yet?
Feb 26, 2009 at 10:17 AM
Try this: http://www.codeplex.com/wpf/Thread/View.aspx?ThreadId=41207&ANCHOR#Post151326
Feb 26, 2009 at 2:38 PM
I'm still working through that and trying to understand it.  First attempt failed.

Wouldn't it just be easier if the datagrid had a property that was settable where I could tell it what class to use to create the new row instance?  Instead of it having to figure it out on information that isn't there (the empty list)?

Here is my actual code that creates the list that is bound to the itemssource:

PersonList := new PersonListCollection<Person>( element.GetAsIList<Person> );
At this point, I am guessing the problem for the datagrid is that I am constructing the instance with a constructor that takes a parameter.  And the parameter is an IList.  And even though it was specified as an IList of Person, I suspect there isn't enough information there for the grid to figure out what to do.

What do you think?

Feb 26, 2009 at 8:27 PM
Edited Feb 26, 2009 at 8:31 PM
I think I give up tracing the code.

And mikj, I think  this link is probably the more relevant post that I stumbled across.  This one says, yep, we know, we'll make it a feature request.