Reputation: 26277
I'm having a go at moving one of our simpler apps to Silverlight (a bit of a learning exercise). I've quickly come unstuck as I can't figure out how to load (or bind maybe?) a csv file to a datagrid (i.e. so you can point the app at a local csv file and display it to the user). I do have boilerplate code to parse a csv file and return a datatable but I'm shocked to discover that Silverlight doesn't even support DataTable (wtf!).
Any ideas at all how to do this? How do people bind data to a datagrid anyhow?
I'm using Silverlight 3.0 included in VS2010.
Upvotes: 1
Views: 6005
Reputation: 26277
Christ finally got it working (might be a bit kludgy tho). So in the end I used the CSVReader (not my code, nicked from someone ages ago):
and then I adapted some code from this excellent idea:
http://blog.bodurov.com/blog/Post.aspx?postID=27
mashing it all together and eventually coming up with:
Thankyouverymuch!
In the end I adapted the CSV reader to use this excelent datatable class
Upvotes: 4