Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 89864

Set ListView ItemSource to a Dynamic Collection

$
0
0

Hi Guys,

I am trying to figure out if what I am trying to do is possible. Basically I have a scenario where the ListView Itemsource List I create is of a class type whose properties can only be determined at run time.

class DynamicClass{
    => Properties of this class needs to be set runtime        
}

DynamicClass lstDynamicClass = new List<DynamicClass>();

...
while (sqlSqliteDataReader.Read())
{
                    DynamicClass fptDynamicClass = new DynamicClass ();
                    fptDynamicClass.PropA= sqlSqliteDataReader.GetString(sqlSqliteDataReader.GetOrdinal("ColA"));
                    fptDynamicClass.PropB= sqlSqliteDataReader.GetString(sqlSqliteDataReader.GetOrdinal("ColB"));

                    lstDynamicClass.Add(fptDynamicClass);
}
...
ListView.ItemSource = lstDynamicClass

Has anyone run into this kind of situation? If yes, it would be great to know how you handled it?

If there is a completely different way of handling this sort of scenario then please share your idea. Thanks.


Viewing all articles
Browse latest Browse all 89864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>