This is a migrated thread and some comments may be shown as answers.

Unable to remove borders from chart legend

1 Answer 48 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Venkatesh
Top achievements
Rank 1
Venkatesh asked on 02 Feb 2012, 01:34 AM
I am using the following code for custom chart legend. I am unable to remove the border of the legend. Can you please tell me how to do.
    <Style x:Key="ChartLegendStyle"
    TargetType="telerik:ChartLegend">
        <Setter Property="Foreground" Value="{StaticResource LegendForeground}" />
        <Setter Property="Background" Value="{x:Null}" />
        <Setter Property="Padding" Value="10,10,10,5" />
        <Setter Property="Margin" Value="0"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Stretch" />
        <Setter Property="LegendItemMarkerShape" Value="{StaticResource LegendItemMarkerShape}" />
        <Setter Property="Template" >
            <Setter.Value>
                <ControlTemplate TargetType="telerik:ChartLegend">
                    <Border
                        Background="{x:Null}"
                        BorderBrush="{x:Null}"
                        BorderThickness="0" >
                        <Grid Margin="{TemplateBinding Padding}">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>
                            <ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto" >
                                <ItemsPresenter/>
                            </ScrollViewer>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <telerik:RadWrapPanel/>
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</UserControl.Resources>

1 Answer, 1 is accepted

Sort by
0
Evgenia
Telerik team
answered on 06 Feb 2012, 05:36 PM
Hello Venkatesh,

The following modification in the Legend Style works as expected on our side. Could you give it a try? :
<UserControl.Resources>
      <Style x:Key="CustomLegendStyle" TargetType="telerik:ChartLegend">
          <Setter Property="BorderBrush" Value="Transparent"/>
      </Style>
  </UserControl.Resources>

RadChart1.DefaultView.ChartLegend.Style = this.Resources["CustomLegendStyle"] as Style;

Kind regards,
Evgenia
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
Chart
Asked by
Venkatesh
Top achievements
Rank 1
Answers by
Evgenia
Telerik team
Share this question
or