WPF: Best method for printing paginated datagrids

后端 未结 2 1602
走了就别回头了
走了就别回头了 2020-12-19 03:32

Boy did I get an education looking into this. I guess I\'ve been spoiled by Powerbuilder, which has fantastic functionality for this out of the box.

Does anyone ser

2条回答
  •  星月不相逢
    2020-12-19 03:55

    I've found the easiest way is to implement a generalized DocumentPaginator class for paginating anything I can put on screen. With my DocumentPaginator I don't need to worry about printing because I can take any arbitrary WPF control and tell it to print, and it will take multiple pages if necessary to display all the data.

    I also use an inherited attached bool property "PrintView" that the user can control. Some of my controls change their appearance somewhat using a trigger on the "PrintView" property, so they will look better when printed.

    I describe my DocumentPaginator solution in more detail in this answer, including a description of the algorithm required.

提交回复
热议问题