Unable to remove borders from chart legend

2 posts, 0 answers
  1. Venkatesh
    Venkatesh avatar
    8 posts
    Member since:
    Dec 2011

    Posted 01 Feb 2012 Link to this post

    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>
  2. Evgenia
    Admin
    Evgenia avatar
    1407 posts

    Posted 06 Feb 2012 Link to this post

    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 >>
  3. DevCraft banner
Back to Top