- How to print DevExpress ChartControl ...
- How to printing ChartControl
- Print of DXChart ....
- How to print of DevExpress WPF ChartControl
- How to print DevExpress ChartControl via SimpleLink (DXPrinting) ...
- Print Preview a WPF Chart and Show Its
- WPF Chart Control - Print of DevExpress DXCharts for WPF
Solution:
Yes, it's simple. just call below method with chart control ;-)
private void PrintChartControl(ChartControl chartControl, bool withPreview = true) { /// Prepare Template var templateImage = new FrameworkElementFactory(typeof(ImageEdit)); templateImage.SetBinding(ImageEdit.SourceProperty, new Binding("Content")); DataTemplate templateData = new DataTemplate() { VisualTree = templateImage }; /// Prepare Simple Link SimpleLink simpleLink = new DevExpress.Xpf.Printing.SimpleLink(); simpleLink.DetailCount = 1; simpleLink.DetailTemplate = templateData; simpleLink.CreateDetail += new EventHandler<CreateAreaEventArgs>((sl_s, sl_e) => { DrawingVisual vDrawing = new DrawingVisual(); DrawingContext context = vDrawing.RenderOpen(); context.DrawRectangle(new VisualBrush(chartControl), null, new Rect(0, 0, chartControl.ActualWidth, chartControl.ActualHeight)); context.Close(); RenderTargetBitmap bmp = new RenderTargetBitmap((int)chartControl.ActualWidth, (int)chartControl.ActualHeight, 96, 96, PixelFormats.Pbgra32); bmp.Render(vDrawing); sl_e.Data = bmp; }); simpleLink.Landscape = true; simpleLink.CreateDocument(true); if (withPreview == true) { simpleLink.ShowPrintPreviewDialog(this); } else { simpleLink.Print(); } }