This example illustrates how to maintain expanded state of groups in printing in WPF DataGrid (SfDataGrid).
All the groups will be printed in expanded state by default in WPF DataGrid (SfDataGrid). You can also avoid this and maintain the expanded states of group as in view when printing by inheriting the GridPrintManager and overriding the GetSourceListForPrinting method.
KB article - How to maintain expanded state of groups in printing in WPF DataGrid (SfDataGrid)?