SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components
how can i apply styling for legend in legend modifier? i want to apply the following style
<Style x:Key="LegendStyle" TargetType="s:LegendModifier">
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<s:SciChartLegend x:Name="legendControl" Margin="2,2" Orientation="Horizontal" Background="Transparent" BorderThickness="0" ScrollViewer.VerticalScrollBarVisibility="Auto"
Visibility="{Binding IsLegendVisible,Converter={StaticResource BoolToVisibilityConverter}}"
LegendData="{Binding LegendData, ElementName=legendModifier,Mode=OneWay}">
<s:SciChartLegend.Resources>
<SciChart:ColorToBrushConverter x:Key="ColorToBrushConverter"/>
</s:SciChartLegend.Resources>
<s:SciChartLegend.ItemTemplate>
<DataTemplate DataType="SciChart:XyzSeriesInfo">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Rectangle Grid.Column="0"
VerticalAlignment="Center"
Stretch="Fill"
Width="10"
StrokeThickness="10"
Stroke="{Binding SeriesColor,
Converter={StaticResource ColorToBrushConverter}}" />
<TextBlock Grid.Column="1" Foreground="Black"
Margin="2,0,15,0"
HorizontalAlignment="Center"
Text="{Binding SeriesName}" FontWeight="Normal"/>
</Grid>
</DataTemplate>
</s:SciChartLegend.ItemTemplate>
</s:SciChartLegend>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
Hi Raghupathy,
Have you seen our Legend API Overview article? It shows you the legend API, including templating the legend items.
We also have an advanced tutorial on legend item templating to introduce custom fields into the legend. Perhaps this helps?
If not, please explain clearly what you need and we will do our best to help.
Best regards,
Andrew
Please login first to submit.