c# - Syncfusion 图表轨迹球风格

标签 c# wpf xaml syncfusion

在我的 Syncfusion WPF 应用程序中,ChartTrackBallBehavior 显示我可以向 ChartTrackBallStyle 添加一些样式。该样式没有任何文档。我不知道可以在图表中设置什么。

有人使用过此控件并设置标签样式以匹配他们的公司外观吗?我需要更改轴中显示的标签的外观。到目前为止,我已经找到了以下 Style 的 Setter,它改变了球的外观,但不改变标签。

    <sfc:SfChart.Behaviors>
      <sfc:ChartTrackBallBehavior ShowLine="True" LabelHorizontalAlignment="Center" LabelVerticalAlignment="Near" >
        <sfc:ChartTrackBallBehavior.ChartTrackBallStyle>
          <Style TargetType="sfc:ChartTrackBallControl" >
            <Setter Property="Control.Visibility" Value="Visible" />
            <Setter Property="Control.Background" Value="AliceBlue" />
            <Setter Property="Control.FontSize" Value="6" />
          </Style>
        </sfc:ChartTrackBallBehavior.ChartTrackBallStyle>
      </sfc:ChartTrackBallBehavior>
    </sfc:SfChart.Behaviors>

最佳答案

我们可以使用 ChartAxis 的 TrackBallLabelTemplat 属性来自定义轨迹球标签样式,如下面的代码片段所示

<sfchart:SfChart.PrimaryAxis>
         <sfchart:NumericalAxis  ShowTrackBallInfo="True" >
                  <sfchart:NumericalAxis.TrackBallLabelTemplate>
                          <DataTemplate >
                                <Border BorderThickness="2" BorderBrush="Black" Padding="3" Background="White">
                                      <TextBlock  FontSize="16" Text="{Binding ValueX}" Foreground="Black"></TextBlock>
                                </Border>
                           </DataTemplate>
                  </sfchart:NumericalAxis.TrackBallLabelTemplate>
         </sfchart:NumericalAxis>
</sfchart:SfChart.PrimaryAxis>

关于c# - Syncfusion 图表轨迹球风格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26854121/

相关文章:

c# - CloudQueueMessage - 重试机制

c# - 在 WPF 中折叠网格

wpf - 如何仅使用 XAML 标记在单击另一个控件时打开 WPF 弹出窗口?

xaml - 带有标题和项目模板列的 Windows 8 XAML ListView 应具有相同的动态宽度

xaml - Windows Phone 8 TextBlock 切断 XAML 中的文本

c# - 无法将类型为 'System.Single' 的对象转换为类型 'System.Int32'

c# - 基于开始/结束位置的字符串中的粗体选择性文本

c# - 将 Linq Except 与两个 int 数组列表一起使用

c# - ScaleTransform 有什么用?

c# - 条件 XAML (WPF)