c# - 禁用 wpftoolkit 图表数据点

标签 c# wpf wpftoolkit charts

有人知道如何关闭 WPFToolkit 图表中 noraml LineSeries 的数据点吗?我发现它们非常烦人,对我的目的没有用,但我在类本身找不到简单的属性或类似的东西。

最佳答案

你想隐藏它们吗?

将空的 ControlTemplate 设置为 Template 属性是可能的。 这是示例:

<Window.Resources>
    <Style x:Key="InvisibleDataPoint" TargetType="{x:Type charting:DataPoint}">
        <Setter Property="Background" Value="Blue"/>
        <Setter Property="Template" Value="{x:Null}"/>
    </Style>
</Window.Resources>
<Grid>
    <charting:Chart>
        <charting:LineSeries ItemsSource="{Binding ChartItems}" IndependentValuePath="XValue" DependentValuePath="YValue" 
                                 DataPointStyle="{StaticResource InvisibleDataPoint}"/>
    </charting:Chart>
</Grid>

虽然点是不可见的,但您可以设置其他属性,例如 Background 并更改图表的外观。

enter image description here

关于c# - 禁用 wpftoolkit 图表数据点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5355425/

相关文章:

wpf - 从wpf窗口获取文本输入

charts - WPF Toolkit 图表中具有相同 Y 轴的两个 LineSeries

c# - WPFToolkit CheckComboBox 宽度问题

c# - 动态生成的组合框值

c# - 如何在没有选择按钮的情况下在 GridView 中实现全行选择?

c# - Automapper:将带有内部对象列表的单个对象映射到列表

c# - 十进制的自定义格式#

c# - 如何从 Blazor 组件调用 '/Identity/Account/ExternalLogin'?

c# - 为什么要使用 MVVM?

wpf - 将 Silverlight 应用程序转换为 WPF