What is the best way to display multidimensional data in WPF? I won’t know the size/shape of the data until runtime. Ideally I would like to use databinding but that is not a strict requirement. I was thinking some sort of grid but I don’t know how to dynamically bind to the data and have it figure out the number of rows and columns. Suggestions and examples please?
Share
Sounds as though you want an Excel-like interface for 2D arrays with editing capability. For the other dimensions, you will have to come up with tabs or a series of comboboxes.
Check out the WPF Toolkit DataGrid. There is an option for auto generate columns. Experiment with that.
However, you will have some code behind to deal with the other dimensions since the Datagrid can only represent 2D data.
Corey
Edit: (04/28/2010) Here is a working solution.
}
The XAML…
Some thing to note about this approach, if you allow editing of data and allow jagged arrays, you will need to new up a new List on the short rows.
As far as > 2D data, you will need some sort of option to select another dimension since the datagrid can only represent 2D data.