Problem in Changing Legend Item Color

Topics: User Forum
Aug 17, 2010 at 5:03 PM
Edited Aug 18, 2010 at 5:13 AM

I am working on the Scatter Series and not able to change the color of the Legend Item IN CASE I HAVE MULTIPLE LEGENDS.

 I have used a control template to apply style to the data point in my scatter series,

But not able to apply the same color to my legend item.

 

<UserControl.Resources>
    <Style x:Key="ScatterPositive" 
      TargetType="charting:ScatterDataPoint">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="charting:ScatterDataPoint">
                    <Ellipse Stroke="Orange"
                              Fill="Transparent"
                             Opacity="0.7" SnapsToDevicePixels="True" StrokeThickness="2" ClipToBounds="True">
                    </Ellipse>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</UserControl.Resources>




<charting:Chart x:Name="char11"  BorderBrush="WhiteSmoke" BorderThickness="2" Loaded="char1_Loaded" Height="600" Width="700" Margin="2,2,2,2" Title="char1" >
    <charting:Chart.Axes>
        <charting:LinearAxis Name="m1" Interval="100" Maximum="600" FontSize="14" ShowGridLines="True" Minimum="0" Orientation="X" Title="m1" BorderBrush="Brown" OpacityMask="Cornsilk" Panel.ZIndex="1" />
        <charting:LinearAxis Name="M2" Interval="100" Maximum="600" FontSize="14" Minimum="0" Orientation="Y" ShowGridLines="True" Title="M2" />
    </charting:Chart.Axes>


    <charting:Chart.Series>
        <charting:ScatterSeries Name="myScatterSeriesFile1" Background="Red" Foreground="Blue" Title="File 1" 
                                 IndependentValueBinding="{Binding Path=Key}"
                                 DependentValueBinding="{Binding Path=Value}" DataPointStyle="{StaticResource ScatterPositive}" Margin="50" OverridesDefaultStyle="False"   BorderBrush="Cyan" BorderThickness="1">
            <!--<charting:Chart.ScatterSeries.LegendItemStyle>
                                    <Style TargetType="LegendItem">
                                        <Setter Property="Width" Value="100"/>
                                        <Setter Property="Height" Value="150"/>
                                        <Setter Property="Background" Value="Gray"></Setter>
                                        <Setter Property="Foreground" Value="White" />
                                        <Setter Property="FontSize" Value="15"/>
                                        <Setter Property="FontWeight" Value="Normal" />
                                        <Setter Property="Margin" Value="10,0,10,0" />
                                    </Style>
                                </charting:Chart.ScatterSeries.LegendItemStyle>-->
        </charting:ScatterSeries>

        <charting:ScatterSeries Name="myScatterSeriesFile2" Background="Red" Foreground="Blue" Title="File 2" 
                                 IndependentValueBinding="{Binding Path=Key}"
                                 DependentValueBinding="{Binding Path=Value}" DataPointStyle="{StaticResource ScatterPositive1}" Margin="50" OverridesDefaultStyle="False" >
        </charting:ScatterSeries>

        <charting:ScatterSeries  Name="myScatterSeriesFile3" Background="Red" Foreground="Blue" Title="File 3" 
                                 IndependentValueBinding="{Binding Path=Key}"
                                 DependentValueBinding="{Binding Path=Value}" DataPointStyle="{StaticResource ScatterPositive2}" Margin="50" OverridesDefaultStyle="False">
        </charting:ScatterSeries>



        </charting:ScatterSeries>

    </charting:Chart.Series>
</charting:Chart>