public GridToPrint GetGridToPrint(int PageNumber)
        {
            GridToPrint gtp;

            gtp        = GridToPrint.Create();
            gtp.Width  = this.size.Width;
            gtp.Height = this.size.Height;
            DataGrid content = GetContent(PageNumber);

            gtp.SetContent(content);

            // Size the Grid.
            gtp.Measure(new Size(Double.PositiveInfinity,
                                 Double.PositiveInfinity));

            Size sizeGrid = gtp.DesiredSize;
            // Determine point for centering Grid on page.
            Point ptGrid =
                new Point((this.size.Width - sizeGrid.Width) / 2,
                          (this.size.Height - sizeGrid.Height) / 2);

            // Layout pass.
            gtp.Arrange(new Rect(ptGrid, sizeGrid));
            return(gtp);
        }
Example #2
0
        public void Test1()
        {
            GridToPrint gPrint = GridToPrint.Create();

            GridToPrint.SetUIElementOnGrid(this.gridMain, 0, 0, gPrint);

            Button btn2 = new Button();

            btn2.Content = "btn2";
            gPrint.SetContent(btn2);
        }