I have a named class
public class testClass
{
public testClass(string showCode, string urn)
{
ShowCode = showCode;
URN = urn;
}
public string ShowCode { get; set; }
public string URN { get; set; }
}
I create an ArrayList, add to the list and bind it to a wpf datagrid
ArrayList l = new ArrayList();
l.Add(new testClass("ose11", "7016463"));
this.grdTestData.ItemsSource = l;
This displays just what I want in the datagrid.
Now I want to get the datagrid's data back and iterate throught it
IEnumerable<testClass> t = this.grdTestData.ItemsSource as IEnumerable<testClass>;
..but 't' is null! !! this is the problem !!
This is the datagrid definition:
<DataGrid AutoGenerateColumns="False" HorizontalAlignment="Left" Margin="12,66,0,48" Name="grdTestData" Width="200" CanUserAddRows="True" >
<DataGrid.Columns>
<DataGridTextColumn Header="ShowCode" Binding="{Binding ShowCode}" />
<DataGridTextColumn Header="URN" Binding="{Binding Path=URN}" />
</DataGrid.Columns>
</DataGrid>