Ever since I've updated SciChart in my application, I've been struggling to make it look and feel somewhat similar to how it used to. Thanks to Dr. ABT I was able to get rid of plaid bands, but now I'm facing problems with grid lines.
In the previous version of SciChart all the grid lines and tick lines seemed to automatically inherit colors defined in styles somewhere upstream in the application. In the new version the lines are just black. So I had to manually override MajorGridLineStyle, MajorTickLineStyle, MinorGridLineStyle and MinorTickLineStyle for each instance of SciChart. But one instance is problematic, because the application logic requires the Y axis to be added from code. Because of this I am unable to style its grid lines in xaml.
I have tried to add the styles in code:
_yAxis = new NumericAxis()
{
...
DrawMajorBands = false,
MajorGridLineStyle = MajorLineStyle,
MinorGridLineStyle = MinorLineStyle
};
The result is that not only are the grid lines not shown, but the actual data series disappears from the graph (along with some line annotations) and all that is displayed is the X axis with its grid lines. I've done some experimenting and I've verified that it's the code that add the styles that causes the problem. The styles I'm using are analogous to the ones I have defined in xaml (which are working properly)
MajorLineStyle = new Style(typeof(Line));
MajorLineStyle.Setters.Add(new Setter(Line.StrokeProperty, Brushes.Pink));
MajorLineStyle.Setters.Add(new Setter(Line.StrokeThicknessProperty, 1));
MajorLineStyle.Setters.Add(new Setter(Line.OpacityProperty, 0.6));
Is this a bug in SciChart, or am I doing something wrong? Is there a way to add have style for programmatically defined axes in the xaml? Is there a way to override the line colors on SciChartSurface level so I don't have to do it individually for each type of line?