Best way to display multiple data items in WPF?
I know there has to be an easy way to do this, I just can't think of it. I need to display a set of notes in a WPF application. The layout for each note would be
Note Name Note Date Note Text
E开发者_运维百科ach item above exists individually in my database access layer and I just need a way to display it. In ASP, this is something I might have created a table for and then used the repeater object to dislay it multiple times (multiple notes).
Is the ListView control the best way to go about this? How would I display multiple items next to each other as above with the NoteName and NoteDate?
You could use a ListView. In this case you would declare a GridViewColumn for each column, with the appropriate DisplayMemberBinding or CellTemplate depending on the complexity of what you wanted to show.
You could also use an ItemsControl or a ListBox, with an appropriate DataTemplate. This is good for when you do not want a strict column layout (e.g. you want to show the Name and Date on one line of big bold text, and the Note Text below that in smaller italic text.)
精彩评论