如何设置 LiveChart 的 CartesianChart AxisX 标签的样式?

How to style LiveChart's CartesianChart AxisX Labels?

我在网上搜索过,但没有找到我要找的东西,甚至根本找不到(到目前为止)。 我有一个笛卡尔图表,我想做的是设置 AxisX 标签的样式。我已经看到如何改变它的颜色,例如,通过设置轴的前景,但是,我想用这种风格实现的是通过居中对齐标签的内容。将 'HorizontalContentAlignment' 设置为 'Center' 似乎很基本,但我还不知道该怎么做。

这是我的示例代码的摘录:

        <lc:CartesianChart LegendLocation="Top">
            <lc:CartesianChart.ChartLegend>
                <local:MonthlySummaryCustomLegendView />
            </lc:CartesianChart.ChartLegend>
            <lc:CartesianChart.AxisX>
                <lc:Axis Title="Days of Month"
                         ShowLabels="True"
                         MaxValue="28"
                         MinValue="1">
                    <lc:Axis.Separator>
                        <lc:Separator Step="1" 
                                      IsEnabled="False">
                        </lc:Separator>
                    </lc:Axis.Separator>
                </lc:Axis>
            </lc:CartesianChart.AxisX>
        </lc:CartesianChart>
        (...)

这是当前呈现方式的屏幕截图:

提前谢谢大家,如有任何帮助或指导,我们将不胜感激。

我不认为有一种干净简单的方法。

  • 您无法通过可视树真正区分轴标签:
  • 您无法在没有反射的情况下访问 AxisSeparatorElementTextBlock 属性,因为它是内部的