Which data binding option for large static list of objects?

Go To StackoverFlow.com

2

I am new to WPF and amazed by its powerful data binding features. However, after reading numerous articles, I am not sure which option to use for my project.

=========== Project Details (involves viewing a locally stored tweet archive):

  • The data consists of locally stored Twitter Tweets - more than 17,000 tweets stored in JSON format in a single file (no Internet connectivity used or needed for project).

  • I am using JSON.Net to parse the JSON in the file and each tweet's dozens of JSON name/value pairs are assigned to a List of Tweet Objects (transforming each tweet's JSON data and into a Tweet Object).

  • My program will use two controls to display the data.

WPF control #1 (similar to a spreadsheet): displays in a grid pattern and text format each Tweet in rows (there will be 17,000+ rows of data). Because there are dozens of fields, the user can choose which fields to display in a limited number of columns (5 or so) that will be visible (e.g., date, sender, text, etc.). The user can search (via Linq), sort and select rows of tweets.

WPF control #2: displays each tweet selected in control #1 in the same format/appearance as it would have appeared in Twitter (e.g., nice color, the basic text, links, etc. in a small rectangle - Twitter publishes a standard for how tweets should appear). If no tweets are selected in control #1, then it displays all 17,000+ tweets via scrolling.

Binding: When the user selects row(s) of tweet(s) in control #1, control #2 is instantly updated to show just the selected tweets in the nice graphic format, and vice-versa (i.e., select tweets in control #2 shows the selected tweet’s data in control #1). There is also a calendar for selecting dates that will result in the associated tweets being displayed in control #1 and control #2.

I was thinking about using CollectionViewSource for control #1, however, that does not seem right because the user never deletes or adds tweets to the List of Tweet Objects. However, trying to scroll, sort and keep everything running smoothy with 17,000+ of data rows and binding to the displayed tweets in control #2, may be too much for other options to handle (I do understand how some options can be virtual if necessary). Perhaps DataGrid is the way to go?

==== ISSUE: what should I use for WPF controls #1 and #2??

Options for control #1 includes: CollectionViewSource, DataGrid, ListView, ListBox

Options for control #2 includes: ? ListBox to host images?

Thanks for your time, consideration and assistance!

2012-04-03 22:14
by Kyle


0

If you are not editing then go ListView GridView (supports columns) and bind to List (now that List may be dynamic output form LINQ but still it is a List). CollectionViewSource is not really about edit - it is about filter and sort - if you are going to use LINQ then why put CollectionViewSource in the picture. Multimaster A master of B and B master of A is a little out there - maybe rethink that logic. With virtualiztion 17000 tweets can be done.

2012-04-04 02:31
by paparazzo
Ads