pan*_*hei 5 silverlight charts silverlight-toolkit
我想从Silverlight图表中的LineSeries中删除数据点标记.我在网上找到的唯一方法是将VisibilityProperty设置为Collapse.
//不在当前的SL工具包版本中工作var collapseDataPointSetter = new Setter(Control.VisibilityProperty,Visibility.Collapsed);
但这不适用于当前版本的SL工具包.如何在当前版本中删除或隐藏DataPoint标记?
Jim*_*rdy 10
pantarhei,
使用以下图表样式(使用引用的模板)隐藏数据点.我已经为LineSeries和AreaSeries包含了样式.
祝你好运,吉姆
<ControlTemplate x:Key="CommonAreaSeriesDataPointTemplate" TargetType="charting:AreaDataPoint">
<!--Comment out data points from the default template; just an empty template-->
<Grid x:Name="Root" Opacity="1">
<!--<ToolTipService.ToolTip>
<StackPanel Margin="2,2,2,2">
<ContentControl Content="{TemplateBinding FormattedDependentValue}" />
<ContentControl Content="{TemplateBinding FormattedIndependentValue}" />
</StackPanel>
</ToolTipService.ToolTip>
<Ellipse StrokeThickness="{TemplateBinding BorderThickness}" Stroke="{TemplateBinding BorderBrush}" Fill="{TemplateBinding Background}" />-->
</Grid>
</ControlTemplate>
<Style x:Key="CommonAreaSeriesDataPoint" TargetType="charting:AreaDataPoint">
<Setter Property="Background" Value="{StaticResource CommonAreaSeriesBackground}" />
<Setter Property="Template" Value="{StaticResource CommonAreaSeriesDataPointTemplate}" />
</Style>
<Style x:Key="CommonAreaSeriesPath" TargetType="Path">
<Setter Property="StrokeThickness" Value="1" />
<Setter Property="Stroke" Value="DarkGray" />
<Setter Property="Effect" Value="{StaticResource DialogDropShadow}" />
</Style>
<ControlTemplate x:Key="CommonLineSeriesDataPointTemplate" TargetType="charting:LineDataPoint">
<!--Comment out data points from the default template; just an empty template-->
<Grid x:Name="Root" Opacity="1">
<!--<ToolTipService.ToolTip>
<StackPanel Margin="2,2,2,2">
<ContentControl Content="{TemplateBinding FormattedDependentValue}" />
<ContentControl Content="{TemplateBinding FormattedIndependentValue}" />-->
<!--Example of how to access the bound business object-->
<!--<ContentControl Content="{Binding Amount}" DataContext="{TemplateBinding DataContext}" />-->
<!--</StackPanel>
</ToolTipService.ToolTip>-->
<!--<Ellipse StrokeThickness="{TemplateBinding BorderThickness}" Stroke="{TemplateBinding BorderBrush}" Fill="{TemplateBinding Background}" />-->
</Grid>
</ControlTemplate>
<Style x:Key="CommonLineSeriesDataPoint" TargetType="charting:LineDataPoint">
<Setter Property="IndependentValueStringFormat" Value="{}{0:yyyy}" />
<Setter Property="DependentValueStringFormat" Value="{}{0:c0}" />
<Setter Property="Background" Value="#FF0077CC" />
<Setter Property="BorderBrush" Value="White" />
<Setter Property="BorderThickness" Value="2" />
<Setter Property="IsTabStop" Value="False" />
<Setter Property="Template" Value="{StaticResource CommonLineSeriesDataPointTemplate}" />
</Style>
<Style x:Key="CommonLineSeriesPolyline" TargetType="Polyline">
<Setter Property="StrokeThickness" Value="5" />
<Setter Property="Effect" Value="{StaticResource DialogDropShadow}" />
</Style>
<!-- Implicit non-Key'd Styles BasedOn Common Explicit Key'd Styles above -->
<Style TargetType="charting:AreaSeries">
<Setter Property="DataPointStyle" Value="{StaticResource CommonAreaSeriesDataPoint}" />
<Setter Property="PathStyle" Value="{StaticResource CommonAreaSeriesPath}" />
</Style>
<Style TargetType="charting:LineSeries">
<Setter Property="DataPointStyle" Value="{StaticResource CommonLineSeriesDataPoint}" />
<Setter Property="PolylineStyle" Value="{StaticResource CommonLineSeriesPolyline}" />
</Style>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8509 次 |
| 最近记录: |