Newrow missing when binding to a IList<interface>

Oct 13, 2008 at 7:01 PM
I have the following code:

public class Customer : ICustomer
{

}
public interface ICustomer{}

When I bind to an empty List<ICustomer> I have no row for the NewItemPlaceHolder - if I add a Customer in the the List<ICustomer>, the NewItemPlaceHolder appears. I realize that the DataGrid has no way of knowing the concrete type I intend to use. My question is whether it is possible to 'force-feed' this information? Ie. somehow make the DataGrid aware that it should use the concrete class Customer.

I would like to avoid using List<Customer> if possible.
Coordinator
Oct 14, 2008 at 1:13 PM
Unfortunately with the current design there is no way to tell the DataGrid (or more importantly the IEditableCollectionView) the concrete implementation for ICustomer.  There have been discussions on how to provide such an extensibility point in IECV but nothing in the current bits.  A workaround that I'm sure you've already thought of for the empty case is to manually contrust the new item yourself. 
Oct 14, 2008 at 8:00 PM
Edited Oct 14, 2008 at 8:04 PM
Yeah - either creating it myself or using a NullCustomer (Null Object Pattern), so that I can still keep the list in-synch with the database and leave the DataGrid untouched.

But anyhow - thanks for clearing it up. I hope a solution is found later - perhaps designing the NewItemPlaceHolder as a Prototype of a type specified - so you could clone this when entering a new row - or the ability to specify an ObjectFactory that should be responsible for creating the new objects. With my limited knowledge of the inner workings - this should be doable - but I have no idea how much existing functionality it would break :-).