private void SaveSvg_Click(object sender, RoutedEventArgs e)
        {
            var d = new SaveFileDialog {
                Filter = "Svg files (*.svg)|*.svg", DefaultExt = ".svg"
            };

            if (true == d.ShowDialog())
            {
                using (var s = d.OpenFile())
                {
                    var rc = new SilverlightRenderContext(new Canvas());
                    SvgExporter.Export(this.plot1.ActualModel, s, this.plot1.ActualWidth, this.plot1.ActualHeight, true, rc);
                }
            }
        }
        /// <summary>
        /// Exports the specified plot model to a stream.
        /// </summary>
        /// <param name="model">The plot model.</param>
        /// <param name="stream">The stream to write to.</param>
        /// <param name="width">The width of the export image.</param>
        /// <param name="height">The height of the exported image.</param>
        /// <param name="background">The background.</param>
        public static void Export(IPlotModel model, Stream stream, double width, double height, OxyColor background)
        {
            var canvas = new Canvas {
                Width = width, Height = height
            };

            if (background.IsVisible())
            {
                canvas.Background = background.ToBrush();
            }

            canvas.Measure(new Size(width, height));
            canvas.Arrange(new Rect(0, 0, width, height));

            var rc = new SilverlightRenderContext(canvas);

            model.Update(true);
            model.Render(rc, width, height);

            canvas.UpdateLayout();
            var image = canvas.ToImage();

            image.WriteToStream(stream);
        }