隐式样式(仍然)不适用于 SciChart WPF

Implicit Styles (still) not working on SciChart WPF

我之前问过这个关于 AxisPanel 的问题:

我开始注意到下面还有更多问题...不确定这是否已在 "last" 更新中修复。

如果我创建隐式样式,比如说...

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

那个样式完全被忽略了。它位于所有事物方案中实际 SciChart 之上,因此我的层次结构是:

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

BorderBrush 本身是从 DefaultStyle 拉取的,据推测(与 Snoop 检查)而不是 ImplicitStyle(Snoop 非常出色地告诉我们它从哪个拉取 -- 但不是 where 样式所在)。 BorderBrush 绑定到 DefaultStyle 并完全忽略隐式样式中设置的任何内容。

我不确定是否遗漏了什么,但最终结果是我们有一些应用程序范围的设置,我们想对所有 SciCharts 进行设置,但支持很少, 除了字面上必须在每个元素上指定样式之外。

我很好奇,根据我的最后一个问题(上面链接),这是否是一个 "large" 问题,不仅仅针对 AxisPanel 并且扩展到所有 SciChart 的 controls/elements -- 并且不仅仅是 AxisPanel 更新为支持 DefaultStyleKey?

提前致谢!

我发现了错误,在这种情况下它似乎在键盘和椅子之间 :P

你需要

    <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>

不是

    <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>

我整理了一个示例 how to set implicit styles on SciChartSurface, NumericAxis and AxisPanel here.

这包含如何在 AxisPanel 上隐式设置样式:

AxisBase.AxisPanelStyle 已添加到构建 中。