Background color doesn't change from white in WPF

Oystein Bjorke 10 years ago 0
This discussion was imported from CodePlex

DennisLer wrote at 2014-03-19 10:57:

Hi

I have started using OxyPlot for a simple graph, but I have a problem regarding setting the background color. It apparently doesn't seem to work ?
The plotAreaBackground is changed correctly.
Even setting it to red, it continues to be white. What I have done is the below:
            plotModel = new PlotModel();
            plotModel.PlotAreaBackground = BackgroundBaseColor.ToOxyColor();
            plotModel.Background = OxyColors.Red;
            DateTimeAxis dateTimeAxis = new DateTimeAxis(AxisPosition.Bottom, "Date", CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern);
            dateTimeAxis.Maximum = DateTimeAxis.ToDouble(DateTime.Today);
            plotModel.Axes.Add(dateTimeAxis);
            
            OxyPlot.MinWidth = ActualWidth;         
            OxyPlot.MaxHeight = ActualHeight;           
            OxyPlot.Model = plotModel;          
            ContainerPanel.Children.Add(OxyPlot);   
I have tried having ContainerPanel both as a stackpanel and grid...

Hope somebody can help.

objo wrote at 2014-03-19 23:17:

Thanks, I see the background of the WPF control was not set by the Background property of the PlotModel. Should be fixed in build 257.