title: OxyPlot WPF generate image in background
body: <p>I have the following problem:</p>
  
  <p>I have a plot in one of my Prism views. My goal is to generate report from my application which includes generated OxyPlot chart. I use the following line to save the plot to the image:</p>
  
  <pre><code>plot.SaveBitmap(fileName, 960, 540, OxyColor.FromRgb(255, 255, 255));
  </code></pre>
  
  <p>The problem occurs when I try to save bitmap without previously see the plot in user interface. In this case I get only the blank plot, white bitmap with correct size but without content. There is no axis, no title (the bitmap is simply blank). When I use function to generate XAML instead of Bitmap, the result is the same: no content at all.</p>
  
  <p>I had also noticed that the plot have both Width and Height set to 0 when plot is saving. Setting this values before Save function does not change the result file.</p>
  
  <p>I have tried following codes just before saving image:</p>
  
  <pre><code>plot.InvalidatePlot();
  </code></pre>
  
  <p>Or even:</p>
  
  <pre><code>plot.InvalidatePlot();
  
  Action emptyAction = delegate { };
  plot.Dispatcher.Invoke(DispatcherPriority.Render, emptyAction);
  
  plot.InvalidatePlot();
  </code></pre>
  
  <p>When I navigate the user interface that I can see the plot: the save function come back to correct behaviour. There are no exceptions, the plot has my data to plot just before saving.</p>
  
  <p>Please, help...</p>