Reputation: 1165
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!
Upvotes: 0
Views: 95
Reputation: 21521
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..
This contains how to set the style on the AxisPanel implicitly:
AxisBase.AxisPanelStyle was added in build v5.1.0.11306 as mentioned here.
Upvotes: 1