0

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

隐式样式在 SciCharts WPF 中不起作用?

我开始注意到还有更多问题……不确定这是否在“最后”更新中得到修复。

如果我创建一种隐式风格,比如说...

<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 出色地告诉我们它从哪个拉取——但不是该 Style 所在的位置)BorderBrush 绑定到 DefaultStyle 并完全忽略隐式样式中设置的任何内容。

我不确定我是否遗漏了什么,但最终结果是我们想要对所有 SciCharts 进行一些应用程序范围的设置,并且除了字面上有为每个元素指定样式。

我很好奇,根据我的最后一个问题(上面链接),这是否是一个“大”问题,不仅仅是 AxisPanel 并且扩展到所有 SciChart 的控件/元素——而且不仅仅是 AxisPanel 被更新以支持 DefaultStyleKey ?

提前致谢!

4

1 回答 1

1

我发现了错误,在这种情况下,它似乎在键盘和椅子之间: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>

我在这里整理了一个示例,展示了如何在 SciChartSurface、NumericAxis 和 AxisPanel 上设置隐式样式。.

在此处输入图像描述

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

在此处输入图像描述

AxisBase.AxisPanelStyle 已添加到构建v5.1.0.11306 中,如此处所述

于 2018-06-09T12:06:04.370 回答