【问题标题】:Implicit styles not working in SciCharts WPF?隐式样式在 SciCharts WPF 中不起作用?
【发布时间】:2018-03-03 04:06:09
【问题描述】:

我正在尝试在 SciCharts 的 AxisPane 上设置一些隐式样式——甚至只是为了更改背景颜色,ala:

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

我尝试将样式放在 Application.Resources 中、SciChartSurface.Resources 中、UserControl.Resources 中,但完全没有运气。

【问题讨论】:

  • 简短回答:否。隐式样式不适用于 AxisPanel。
  • 我意识到看起来我必须解决样式的一些不同部分才能达到我想要的效果。令人沮丧,但可能。

标签: wpf scichart


【解决方案1】:

问题在于 AxisPanel 缺少 DefaultStyleKey,并且由于模板中默认设置了各种属性,因此未应用隐式样式。

我们向 AxisBase 添加了一个名为 AxisPanelStyle 的属性。这使您可以通过父轴将样式直接应用于轴面板:

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

此更改已提交到 scichart v5.1.0.11306 并很快推送到 nightly build。

最好的问候, 安德鲁

[SciChart 技术主管]

【讨论】:

  • 太快了!谢谢。
猜你喜欢
  • 2017-06-25
  • 2013-06-25
  • 2015-04-12
  • 1970-01-01
  • 1970-01-01
  • 2021-11-20
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多