Hi everyone,
we're moving from WinForms to WPF.
Our old WinForms-Application had a third-party grid which was able to group columns and freeze them on the left and right.
According to several general WPF forums (see also Telerik-GridView threads: http://www.telerik.com/community/forums/silverlight/gridview/how-to-lock-the-columns.aspx
http://www.telerik.com/community/forums/silverlight/gridview/freezing-last-column.aspx ) freezing columns on the right seems to be a missing functionality in all(?) WPF datagrids.
Surely, we don't want our customers to miss that functionality, so we have written a custom control which contains two datagrids (System.Windows.Controls.DataGrid, one to the left and one to the right).
Both datagrids share the same itemssource and actions like sorting, vertical scrolling, selecting, columns/row resizing, mouse over events etc. were "synchronised".
To have a column frozen to the left, the column is "moved" (= visibilty switch) to the left datagrid, its display index is set to "FrozenColumnCount + 1" and the FrozenColumnCount is increased.
To have a column frozen to the right, the column is moved to the right datagrid where all columns were frozen.(*)
This custom control delivered a grid which was able to freeze columns on the left and the right.
Still missing was that grouping function which the old WinForms grid additionally had.
We decided to use the Telerik GridView which should replace the datagrid in our custom control.
Same procedure as mentioned...additionally we had to "synchronise" the grouping and the expanding/collapsing of each GridViewGroupRow.
Last-mentioned seems to be an unmanageable hurdle.
The "synchronising" of the grouping enables that the same GridViewGroupRows are available in both datagrids.
If a GridViewGroupRow is expanded or collapsed, we programmatically look for the GridViewGroupRow with the same group key (and parent group keys) in the other GridView and set the "IsExpanded" property to the according value. At first glance this seemed to work, but unfortunately sometimes the GridViewGroupRow stayed collapsed/expanded in the UI.
According to the debugger the property is also correctly set, the UI is not blocked.
We have no explanation for this and don't expect them here. This thread should only share our attempt to create a grid with left and right freezing and grouping functionality, in hope to gain some other valuable programmers experience/information concerning this matter and answers to following questions:
Has anyone successfully created a grid which has draggable grouping and left and right freezing functionality?
Is Telerik planning to extend the GridView with 'freezing right/last columns' functionality?
Answers why the GridViewGroupRow does sometimes not collapse/expand if this is done programmatically
(Note: Virtualization has been disabled! And even if not, the according GridViewGroupRow is available programmatically and visible in UI) ?
--------------------------------------------------------------------------
Notes only for those interesting which like to implement it that way:
(*) Left datagrid should be in a column definition with GridLength.Star, right datagrid should be in a column definition with GridLength.Auto.
Width of right datagrid must be calculated (sum each visible column width) since datagrid doesn't auto resize if columns are narrowed.
we're moving from WinForms to WPF.
Our old WinForms-Application had a third-party grid which was able to group columns and freeze them on the left and right.
According to several general WPF forums (see also Telerik-GridView threads: http://www.telerik.com/community/forums/silverlight/gridview/how-to-lock-the-columns.aspx
http://www.telerik.com/community/forums/silverlight/gridview/freezing-last-column.aspx ) freezing columns on the right seems to be a missing functionality in all(?) WPF datagrids.
Surely, we don't want our customers to miss that functionality, so we have written a custom control which contains two datagrids (System.Windows.Controls.DataGrid, one to the left and one to the right).
Both datagrids share the same itemssource and actions like sorting, vertical scrolling, selecting, columns/row resizing, mouse over events etc. were "synchronised".
To have a column frozen to the left, the column is "moved" (= visibilty switch) to the left datagrid, its display index is set to "FrozenColumnCount + 1" and the FrozenColumnCount is increased.
To have a column frozen to the right, the column is moved to the right datagrid where all columns were frozen.(*)
This custom control delivered a grid which was able to freeze columns on the left and the right.
Still missing was that grouping function which the old WinForms grid additionally had.
We decided to use the Telerik GridView which should replace the datagrid in our custom control.
Same procedure as mentioned...additionally we had to "synchronise" the grouping and the expanding/collapsing of each GridViewGroupRow.
Last-mentioned seems to be an unmanageable hurdle.
The "synchronising" of the grouping enables that the same GridViewGroupRows are available in both datagrids.
If a GridViewGroupRow is expanded or collapsed, we programmatically look for the GridViewGroupRow with the same group key (and parent group keys) in the other GridView and set the "IsExpanded" property to the according value. At first glance this seemed to work, but unfortunately sometimes the GridViewGroupRow stayed collapsed/expanded in the UI.
According to the debugger the property is also correctly set, the UI is not blocked.
We have no explanation for this and don't expect them here. This thread should only share our attempt to create a grid with left and right freezing and grouping functionality, in hope to gain some other valuable programmers experience/information concerning this matter and answers to following questions:
Has anyone successfully created a grid which has draggable grouping and left and right freezing functionality?
Is Telerik planning to extend the GridView with 'freezing right/last columns' functionality?
Answers why the GridViewGroupRow does sometimes not collapse/expand if this is done programmatically
(Note: Virtualization has been disabled! And even if not, the according GridViewGroupRow is available programmatically and visible in UI) ?
--------------------------------------------------------------------------
Notes only for those interesting which like to implement it that way:
(*) Left datagrid should be in a column definition with GridLength.Star, right datagrid should be in a column definition with GridLength.Auto.
Width of right datagrid must be calculated (sum each visible column width) since datagrid doesn't auto resize if columns are narrowed.