コード例 #1
0
        private void OnDataGridPrinting(object sender, RoutedEventArgs e)
        {
            var Printdlg = new PrintDialog();

            if (Printdlg.ShowDialog().GetValueOrDefault())
            {
                var pageSize = new Size(Printdlg.PrintableAreaWidth, Printdlg.PrintableAreaHeight);
                // sizing of the element.
                Works.Measure(pageSize);
                Works.Arrange(new Rect(25, 25, pageSize.Width, pageSize.Height));
                Printdlg.PrintVisual(Works, Title);
            }
        }