DataGrid.ItemSource=IEnumerable doesn't work

Dec 25, 2009 at 1:43 AM

Hello All.

I'm binding a DataGrid to some specific property, which is not  an IList, but IEnumerable .

As a result I see little rows and no columns. :(  :(  :(

(Concretely,

dataGrid.ItemSource = contractor.Contracts;

where Contracts is

public class EntitySet<TItem> : EntitySetBase, 
 ICollection<TItem>, ICountable<TItem>, ICountable, IQueryable<TItem>, 
 IEnumerable<T>, IQueryable, IEnumerable
where TItem : Entity
 )

 

Well, I tried to bind to IList:

dataGrid.ItemSource = contractor.Contracts.ToList();

Now all looks fine. But I need to edit just my Contracts property,  not a list :)

 What's wrong ?

 Does DataGrid need ILIst as ItemSource ?

 Or may be there is some other way to make it look properly ?