【发布时间】:2014-07-04 03:37:22
【问题描述】:
以下是我用于 LineSeries 的 DataPointStyle 的样式:
<Style x:Key="LineDataPointStyle" TargetType="chrt:LineDataPoint">
<Setter Property="Background" Value="#0077CC" />
<Setter Property="BorderBrush" Value="White" />
<Setter Property="BorderThickness" Value="2" />
<Setter Property="IsTabStop" Value="False" />
<Setter Property="Height" Value="10" />
<Setter Property="Width" Value="10" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="chrt:LineDataPoint">
<Grid x:Name="Root" Opacity="1">
<ToolTipService.ToolTip>
<StackPanel Margin="2,2,2,2">
<ContentControl Content="{TemplateBinding IndependentValue}" ContentStringFormat="X-Value: {0:HH:mm:ss}"/>
<ContentControl Content="{TemplateBinding DependentValue}" ContentStringFormat="Y-Value: {0:###.###}"/>
</StackPanel>
</ToolTipService.ToolTip>
<Ellipse StrokeThickness="{TemplateBinding BorderThickness}" Stroke="{TemplateBinding BorderBrush}" Fill="{TemplateBinding Background}"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
我不想硬编码 Background 属性,而是想在运行时设置它。如何将背景绑定到 LineSeries 的背景?
【问题讨论】:
-
您想根据您的属性更改背景吗?你可以使用触发器来做到这一点
-
@nit :我正在为 DataPoint 定义一个默认样式。但是如果图表中有多个系列,线条的颜色应该是可设置的
标签: c# wpf wpftoolkit