Custom legend item border

3 posts, 1 answers
  1. Bhakti
    Bhakti avatar
    23 posts
    Member since:
    Jan 2011

    Posted 03 Feb 2012 Link to this post

     <SolidColorBrush x:Key="LegendBorderBrush"  Color="White" />
            <Thickness x:Key="LegendBorderThickness">0</Thickness>
            <Style x:Key="CustomLegendItemStyle" TargetType="telerik:ChartLegendItem">
                <Setter Property="BorderBrush"
                Value="{StaticResource LegendBorderBrush}" />
                <Setter Property="BorderThickness"
                Value="{StaticResource LegendBorderThickness}" />


                <Setter Property="Template" >
                    <Setter.Value>
                        <ControlTemplate TargetType="telerik:ChartLegendItem" >
                            <Border BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="{TemplateBinding BorderThickness}"
                                    Background="{TemplateBinding Background}">
                                <Grid x:Name="PART_MainContainer" HorizontalAlignment="Stretch" VerticalAlignment="Top" Margin="0,0,5,0"  >


                                    <Path x:Name="PART_LegendItemMarker"                                 
                                      Height="20"
                                      Width="80"
                                      Style="{TemplateBinding ItemStyle}"
                                      Stretch="Fill"
                                      >
                                        <Path.Data>
                                            <PathGeometry x:Name="PART_ItemMarkerGeometry" />
                                        </Path.Data>
                                    </Path>


                                    <CheckBox IsChecked="True"
                                          VerticalAlignment="Center"
                                          Margin="2,0"
                                          Content="{TemplateBinding Label}"
                                          Foreground="{TemplateBinding Foreground}"                                      
                                          BorderThickness="0"
                                          Checked="CheckBox_Checked" Unchecked="CheckBox_Checked"   />


                                </Grid>
                            </Border>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

    Above code used to set the radchart legend items. I do not need to display border color for legend items. Setting white,transparant or borderthickness 0 is not helping. Please throw some light. Thanks.
  2. Answer
    Sia
    Admin
    Sia avatar
    667 posts

    Posted 08 Feb 2012 Link to this post

    Hello Bhakti,

    Please find our answer in the other forum thread concerning the same issue.
    We hope that the provided solution works as expected on your end.

    Greetings,
    Sia
    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. UI for WPF is Visual Studio 2017 Ready
  4. Bhakti
    Bhakti avatar
    23 posts
    Member since:
    Jan 2011

    Posted 08 Feb 2012 Link to this post

    Worked as needed!
Back to Top