Hi. I am making an application using the Compact Framework for a PPC.
Essentially what I am trying to do is, read a table from a external
datasource, and try to display it using the datagrid. For my purposes, I
can't use DataTable and DataSet, etc. etc. ie. So I am implementing
iTypedList. To put it simply, I need to override the 'Count' property such
that the datagrid will know the exact number of elements in my external
datasource, but only retrieve the rows on a needed basis (instead of loading
the complete table consisting of 1000's of rows into memory using a
DataTable/DataSet). Sadly, I can't just extend DataTable since the methods I
need to override are not virtual/override.
Now the problem occurs when I am implementing the GetItemProperties() method
in iTypedList. Typically, you would just retrieve all the necessary
properties from the "Row" object and create the the
PropertyDescriptorCollection object. Now my problem is, until I read the
table from the external data source, I don't know what the "Row" objects
properties should be (ie. I don't know the schema of the row object until
run-time). I was trying to figure out how DataRow/DataTable did this, but
had no luck.
DataRow seems to have an 'Object [] ItemArray' property which looks
promising. Sadly, I couldn't figure out how to create the
PropertyDescrptorCollection using an Array object. If I could figure this
out, all I need is one array object, and my schema/data values will be
contained within this array. Then within the GetItemProperties() method I
can generate the proper descriptors. The other option would be to I guess
generate a custom "Row" object with the correct schema during runtime. But
since the PropertyBuilder class is not supported under the Compact
Framework, I don't think that's feasible - or memory efficient for that
matter..
If anyone has any suggestions, that would be great!. Thanks in advance.
Chankama