This question is locked. New answers and comments are not allowed.
Hello.
I'm trying to use the GridView to automatically display the fields of my object. so, lets start with that object:
| public class Item |
| { |
| public Item() { } |
| public int Id { get; set; } |
| public string Name { get; set; } |
| public DateTime Creation { get; set; } |
| } |
Then I generate some dummy data, to test the grid:
| private List<Item> GenerateFakeData() |
| { |
| List<Item> list = new List<Item>(); |
| for (int i = 0; i < 10; i++) |
| { |
| list.Add(new Item { Id = i, Name = "Name (" + i + ")" }); |
| } |
| return list; |
| } |
Finally i bind my list to the Grid:
| this.radGridViewDataBinding.ItemsSource = GenerateFakeData(); |
This works well. The problem is if I change the DataType of the Item to object (in my Generator) as follow :
| private List<object> GenerateFakeData() |
| { |
| List<object> list = new List<object>(); |
| for (int i = 0; i < 10; i++) |
| { |
| list.Add(new Item { Id = i, Name = "Name (" + i + ")" }); |
| } |
| return list; |
| } |
This way it does'nt work....
Since I'm generating item dataType in runtume (by reflection), I cannot instantiate the Generic type of the List to any kind of object.
Is this a bug, or a feature?
How can I workaround this problem?
Thanks in advance
Paulo Paiva