This behavior can be caused by wrong set of Key attribute in your model class. If in the result query, rows with Key field are duplicated, then DataGrid will take only first.
Example (book store info ):
Your result class (BookPriceInfo.cs) looks like this:
public class BookPriceInfo {
[DataMember]
[Key]
public int BookId { get; set; }
[DataMember]
public string Name {get; set; }
[DataMember]
public string StoreName {get; set;}
[DataMember]
public decimal Price {get; set;}
}
And if you have query result returned from database :
BookId | Name | StoreName | Price
1 | book1 | store1 | 70.00
1 | book1 | store2 | 69.99
2 | book2 | store1 | 40.00
2 | book2 | store2 | 39.99
Then DataGrig will show only this :
BookId | Name | StoreName | Price
1 | book1 | store1 | 70.00
2 | book2 | store1 | 40.00
this happens because of DataGrid will 'distinct' the results by field marked as Key
(get only first row from all rows with same BookId), because it should be uniq for all rows.
Solution
Remove Key
attribute from field which will have duplicated values (BookId) and set it to field which will have uniqe values for all rows (you can add some column like BookPriceId, which will be uniqe).
public class BookPriceInfo {
[DataMember]
public int BookId { get; set; }
[DataMember]
public string Name {get; set; }
[DataMember]
public string StoreName {get; set;}
[DataMember]
public decimal Price {get; set;}
[DataMember]
[Key]
public int BookPriceId {get; set;}
}
Query result:
BookPriceId | BookId | Name | StoreName | Price
1 | 1 | book1 | store1 | 70.00
2 | 1 | book1 | store2 | 69.99
3 | 2 | book2 | store1 | 40.00
4 | 2 | book2 | store2 | 39.99
After that you should see all rows returned by query.
Hope this helps :)