Search code examples
wpfscichart

Implicit styles not working in SciCharts WPF?


I'm trying to set some implicit styles on the AxisPane of SciCharts -- just even to change a background color, ala:

<Style TargetType="{x:Type SciCharts:AxisPanel}">
    <Setter Property="Background" Value="Red"></Setter>
</Style>

I've tried placing the style in the Application.Resources, inside the SciChartSurface.Resources, in a UserControl.Resources, and have had absolutely no luck.


Solution

  • The issue was that the AxisPanel was missing DefaultStyleKey and because of various properties set by default in the template, implicit styles were not applying.

    We have added a property to AxisBase called AxisPanelStyle. This lets you apply a style directly to the axis panel via the parent axis:

     <s:SciChartSurface>
          <s:SciChartSurface.XAxis>
               <s:NumericAxis AxisPanelStyle="{StaticResource AStyleWithTargetTypeAxisPanel}"/>              
          </s:SciChartSurface.XAxis>
     </s:SciChartSurface>
    

    This change has been committed to v5.1.0.11306 of scichart and pushed to nightly build shortly.

    Best regards, Andrew

    [SciChart tech lead]