silverlightsilverlight-3.0chartssilverlight-toolkit

How to make smaller points on a Silverlight Toolkit's LineChart?


By default if you take a look at the Silverlight toolkit demo site,

http://silverlight.net/content/samples/sl3/toolkitcontrolsamples/run/default.html

you will see on the LineChart some points which are relatively big.

As far as I know every point on the Chart is an Ellipse. For that I created the style on xaml file.

  <Style x:Name="ChartLineBar" TargetType="Ellipse">
       <Setter Property="Width" Value="10"/>
       <Setter Property="Height" Value="10"/> 
   </Style>

and bind like this:

series.DataPointStyle = Resources["ChartLineBar"] as Style;

This did not work, so after that I decided to like that: I basically recreate the structure which are showing the points.

       <Style x:Name="ChartLineBar" TargetType="chartingToolkit:LineDataPoint">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="chartingToolkit:LineDataPoint">
                    <Grid x:Name="Root">
                        <Ellipse Width="10" Height="10" Visibility="Visible" Opacity="1" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

This did not work either, but I think that there should exist a solution for that because, if I use the SilverlightSpy, I can access all the properties and if I modify there the point's size is decreasing. How can I make smaller points on a silverlight LineChart?


Solution

  • The July 09 source code shows the default width and height to be 8 so I'm not sure setting them to 10 would make them smaller.

    Have you tried it like this:-

    <Style x:Name="ChartLineBar" TargetType="chartingToolkit:LineDataPoint">
        <Setter Property="Width" Value="10"/>
        <Setter Property="Height" Value="10"/> 
    </Style>
    

    Note that the TargetType is LineDataPoint.