Click here to Skip to main content
15,920,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm looking to build a two-dimensional display of objects (not a tabular display).

The objects come from a List<> and the number of rows and columns will be apparent only at run time. We need to make sure the objects are aligned in the proper row and column (they have fields indicating row and column). Some objects will have more field values than others, so a scrolling within the little cells would be great.

Desired display:

________________________________________________________________________
<br>
  Obj 1           |  Obj 2          |  Obj 3           | Obj n         
  Field value 1   |  Field value 1  |  Field value 1   |Field value 1  
  Field value 2   |  Field value 2  |  Field value 2   |Field value 2   
.....             |  detail 1       |  detail 1
                  |  detail 2       |
________________________________________________________________________
  Obj n+1         | Obj n+2          |  Obj n+3         |....
  Field value 1   |  Field value 1   |  Field value 1   |
  Field value 2   |  Field value 2   |  Field value 2   |
.....             |
________________________________________________________________________
.....

</br>


What type of Control works best for this?
Are there any examples of building this type of display?

Thanks,
Posted
Comments
Henry Minute 28-Oct-10 6:15am    
Anything that can be done in xaml can be done in code behind. Given that you don't know the dimensions until runtime it would probably be easier for you to do it in code until you get more familiar with WPF. Incidentally I would recommend that you google for 'c# wpf listbox' there are some good examples of fancy stuff you can do with them. Very Pretty :)

I would start out using a Grid. in each cell of the Grid you could put any control that can display text and can also scroll. A TextBox or a ListBox for example.

I am unable to find an example at the moment, but will continue searching and will get back to you if I find something suitable.
 
Share this answer
 
Comments
Scientific Mitch 28-Oct-10 0:00am    
Thank you! Would you build this Grid in code, given that we don't know the number of rows, columns until run-time or is there a way to dynamically size the Grid through XAML and binding?
Scientific Mitch 30-Oct-10 0:10am    
OK; built this Grid in code. Works nicely and was relatively easy. Thanks!
I am unable to find an example that does exactly what you want but this[^] (this one - UsingDataBindinginWPF.exe, last in the list) shows putting a ListBox in a Grid and should give you a start.

Hope this helps. :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900