xaml side:
<DataGrid Name="MyGrid" ItemsSource="{Binding}" />
I tried also with:
<DataGrid Name="MyGrid" ItemsSource="{Binding MyObj}" />
The code behind:
MyGrid.ItemsSource = new[] {
new MyObj{A = "aaa", B = "sss"},
new CompteurDate{A = "bbb", B = "eee"}
};
The result shows the correct number of items in the grid, but the rows are blank.
Im sure it’s deadly easy but Im stuck :-/
Any idea?
Thanks in advance,
Eric
Sorry Rachel, I didn’t post properly:
Should have been:
Sorry about that.. (I a
Anyway, I found my way! The object kind I was using was in cause. Whit this it didn’t work:
And like that it did:
So I step out of my hello world code, back to my real life implemantation, and…. it didn’t work, damn.
I had an IEnumerable instead of an array. Long story short, adding a “ToArray()” at the end made it, but I don’t understand why. Ok, my enumerable was subject to late execution, but the datagrid reading its ItemsSource shoud have trigged this execution, isn’t it?
So, problem solved but if someone have some rational light to put on this magic…
Thanks!