问题
I have a requirement to create a "super grid" as part of an application, which will consist of multiple frozen and scrolling panes. The grid also has the requirements that it must support the following features:
- Display a datagrid with 100s of rows with “reasonable” scrolling performance
- Group by a certain field, collapse/expand grouped
- Display any control inside a field, e.g. images, text, combobox, button
- Allow buttons and editing of fields as well as read-only mode
- Allow multiple vertical split panes (or workaround, multiple synchronised grids)
- User column re-ordering with persistence
- User column sorting ascending/descending
- Dynamic insertion/deletion of columns (column choosing)
- 4th dimension below grouping – RowDetails template on selected row
- Allow Flashing / animated cell/row templates on value update
My initial feasibility suggests that the WPF Datagrid is capable of almost all the requirements above (with heavy templating), however the multiple vertical split panes may not be covered. Below is a diagram of what I'm trying to achieve:
I would like to enquire if anyone has done this before and if so, what grid technology you have used.
- Can the above be done in WPF Datagrid? I am aware of Frozen columns however this appears to apply to freezing the first N columns only
- Can the above be achieved with multiple grids and synchronizing the Vertical scroll positions?
- If so, will this solution still be virtualized?
- Are there any third party grids you can recommend to achieve this instead? Please note we will be heavily styling the grid according to in-house branding so it must be flexible and Blendable
Any comments/suggestions appreciated.
Update - Feasibility Investigation Results
- I have a working prototype for this using 3x grids and collapsable grid splitters between them.
- The scrollviewers are synchronized using the answer from this question.
- Selected row synchronized across three grids by binding to a common SelectedIndex property with TwoWay binding.
I will be working on grouping and rowdetails templates next... Thanks to answerers for your points! :)
回答1:
I've implemented most of your requirements and more with the devexpress wpf grid control. It's not free and there's a bit of a learning curve (their documentation is essential), but it'll save you so much time in the long run...
回答2:
I've done this with a standard DataGrid
with perfect performance and ultimate flexibility, but it requires a sound architecture. Both data and UI need to be virtualized - no control can annul the cost of sorting a large set of data (for example), so if that sorting is happening on the UI thread, the user will notice. If your back-end supports paging and filters, your front-end can virtualize and the user will never know that only 100 rows have been loaded out of their 10000. As they scroll, pages of data are loaded & unloaded in the background and the UI never ceases to be responsive.
However, knowing where you work leads me to suspect that your front-end is the real workhorse...
来源:https://stackoverflow.com/questions/9158926/wpf-datagrid-multiple-synchronised-frozen-collapsable-panes-separated-by-gridsp