0

I had asked this question before, in regards to the AxisPanel:

Implicit styles not working in SciCharts WPF?

I'm starting to notice that there are more issues further down... not sure if this was fixed in the "last" update or not.

If I create an implicit style, say...

<Style TargetType="{x:Type SciCharts:SciChartSurface}" BasedOn="{x:Type SciCharts:SciChartSurface}">
    <Setter Property="BorderBrush" Value="Red" />
</Style>

That the style is completely ignored. It's placed above the actual SciChart in the scheme of all things, such that my hierarchy is:

<SomeControl>
   <SomeControl.Resources>
       Implicit Styles Here
   </SomeControl.Resources>
   <Some Other Control />
   <SciChartSurface />
</SomeOtherControl>

The BorderBrush itself is pulling from the DefaultStyle, supposedly (checking with Snoop) and not the ImplicitStyle (Snoop does a marvelous job of telling us which it pulls from -- but not where that Style is located). The BorderBrush is bound to the DefaultStyle and completely ignores whatever is set in the Implicit Style.

I'm not sure if there is something I'm missing, but the end result is that we have some application-wide settings we'd like to make to all of our SciCharts and very little support to do it, aside from literally having to specify a style on every element.

I'm curious if, per my last question (linked above), that this was a "large" issue for more than just AxisPanel and extended to all of the SciChart's controls/elements -- and more than just AxisPanel was updated to support DefaultStyleKey?

Thanks in Advance!

Locke
  • 1,133
  • 11
  • 32

1 Answers1

1

I found the error, in this case it appears to be between keyboard and chair :P

You need

    <Style TargetType="{x:Type s:SciChartSurface}" BasedOn="{StaticResource {x:Type s:SciChartSurface}}">
        <Setter Property="BorderBrush" Value="Red" />
        <Setter Property="Margin" Value="10"/>
        <Setter Property="BorderThickness" Value="10"/>
    </Style>

not

    <Style TargetType="{x:Type s:SciChartSurface}" BasedOn="{x:Type s:SciChartSurface}">
        <Setter Property="BorderBrush" Value="Red" />
        <Setter Property="Margin" Value="10"/>
        <Setter Property="BorderThickness" Value="10"/>
    </Style>

I put together an example showing how to set implicit styles on SciChartSurface, NumericAxis and AxisPanel here..

enter image description here

This contains how to set the style on the AxisPanel implicitly:

enter image description here

AxisBase.AxisPanelStyle was added in build v5.1.0.11306 as mentioned here.

Dr. Andrew Burnett-Thompson
  • 20,980
  • 8
  • 88
  • 178
  • 1
    Sorry about that -- I'm having to write code here manually, as to not give away out private code -- there should be a StaticResource in there, yes, and that is how it is in the original source. However, this is still an issue. Unfortunately, I think the problem may be that we aren't on the latest version of SciChart, which is an organizational thing. Looks like we may still be on a low version of 4.x, so I may have to go look at the ChangeLogs (are there any) and consult with our licensing folks to coordinate with SC. – Locke Jun 10 '18 at 14:59
  • No worries at all! Any issues, we'll be happy to help – Dr. Andrew Burnett-Thompson Jun 10 '18 at 16:25