This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Is there any support for printing built into the DataGrid? Any suggestions on how to approach printing (pagination)? I don't think PrintDialog.PrintVisual isn't going to cut it. Thanks. |
|
|
Hello Jared There is currently no built in printing support. There are a few of ways you may be able to tackle this. One way would be to use a VisualBrush to snapshot the data grid in your application and use this to build up the print document. you'd need to use the BringRowIntoView method to scroll the data grid to take snapshots of all the items. When building up the pages in the print document, you may want to include the data grid header at the top of each page. Another way to do this would be to create a data grid in an invisible window and use the same VisualBrush technique to take snapshots and build up the print document. This approach would give you better control on the layout of the grid (e.g. setting it's width), you could set the height to be quite large so you can snapshot many rows at once, and you could apply different styles to the rows, cells and columns headers that may be more printer friendly. Another approach you could explore is to make some kind of print-preview window which essentially displays an actual DataGrid control on each page. You would need to give each DataGrid a cut down version of the overall items source which only includes the items that fit on the page. Then you can iterate through each page and print it. Again this approach gives you better control of the layout and lets you provide different styles/templates if you needed. And a final alternative would be to build the print document without using a DataGrid control. Instead build up each page manually and use templates to render each item. Personally I think this will be the best solution, though it depends on how you want it to look. Let me know if you need more information about these solutions, and we'd love to know if you come up with some better approaches. Jason Fauchelle |
|
|
I think your final alternative is the route I had envisioned pursuing. Thank you for the feedback. It will be a while before I get to the point of implementing anything for printing, but I'll try to post back here on the route I take. Thanks. |
|