Using FixedDocument, DocumentViewer and PrintDialog you can easily create your own print and/or print preview for RadGridView for WPF.
I’ve made two extension methods Print() and PrintPreview() to illustrate how to turn the grid into a print friendly document in few lines of code:
…
public static void PrintPreview(this GridViewDataControl source) { var window = new Window() { Title = "Print Preview", Content = new DocumentViewer() { Document = ToFixedDocument(ToPrintFriendlyGrid(source), new PrintDialog()) } }; window.ShowDialog(); } public static void Print(this GridViewDataControl source, bool showDialog) { var dialog = new PrintDialog(); var dialogResult = showDialog ? dialog.ShowDialog() : true; if (dialogResult == true) { var viewer = new DocumentViewer(); viewer.Document = ToFixedDocument(ToPrintFriendlyGrid(source), dialog); dialog.PrintDocument(viewer.Document.DocumentPaginator, ""); } }
…
Vladimir Enchev is Director of Engineering, Native Mobile UI & Frameworks