Removal of space

5 posts, 0 answers
  1. Kiran Ghanwat
    Kiran Ghanwat avatar
    38 posts
    Member since:
    Nov 2009

    Posted 30 Jun 2010 Link to this post

    Hello Community,

        I have to remove empty space between X-axis labels and Legends, where Legends are arranged at the bottom of dock.
        Please find image attached.

        
    Thanks in advance,
    Kiran Ghanwat
  2. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 30 Jun 2010 Link to this post

    Hello Kiran,

    You will need to modify the ChartLegend template in order to remove the legend header ContentControl that occupies the described space like this:

    XAML:
    <UserControl x:Class="SilverlightApplication1.MainPage"
        mc:Ignorable="d"
        d:DesignHeight="300" d:DesignWidth="400">
        <UserControl.Resources>
            <SolidColorBrush x:Key="LegendForeground" Color="#FF000000" />
            <LinearGradientBrush x:Key="LegendBackground" EndPoint="1.96,0.5" StartPoint="-0.96,0.5">
                <GradientStop Color="#FFB5B5B5"/>
                <GradientStop Color="#FFF0F0F0" Offset="0.5"/>
            </LinearGradientBrush>
            <SolidColorBrush x:Key="LegendBorderBrush" Color="#FF848484" />
     
            <Style x:Key="CustomLegendStyle" TargetType="telerik:ChartLegend">
                <Setter Property="Foreground" Value="{StaticResource LegendForeground}" />
                <Setter Property="Background" Value="{StaticResource LegendBackground}" />
                <Setter Property="Padding" Value="10,10,10,5" />
                <Setter Property="Margin" Value="0,0,0,0"/>
                <Setter Property="BorderBrush" Value="{StaticResource LegendBorderBrush}" />
                <Setter Property="BorderThickness" Value="1,1,1,1" />
                <Setter Property="TitleFontWeight" Value="Bold" />
                <Setter Property="Template" >
                    <Setter.Value>
                        <ControlTemplate TargetType="telerik:ChartLegend">
                            <Border
                                Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}" >
                                <Grid Margin="{TemplateBinding Padding}">
                                    <!--<Grid.RowDefinitions>
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="*" />
                                    </Grid.RowDefinitions>
                                    <ContentControl Foreground="{TemplateBinding Foreground}"
                                                    FontWeight="{TemplateBinding TitleFontWeight}"
                                                    Content="{TemplateBinding Header}"
                                                    ContentTemplate="{TemplateBinding HeaderTemplate}"/>-->
                                    <ItemsPresenter Grid.Row="1" />
                                </Grid>
                            </Border>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
                <Setter Property="ItemsPanel" >
                    <Setter.Value>
                        <ItemsPanelTemplate>
                            <telerik:RadWrapPanel Orientation="{Binding ItemsPanelOrientation}" />
                        </ItemsPanelTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </UserControl.Resources>
     
        <Grid x:Name="LayoutRoot" Background="White">
            <telerik:RadChart x:Name="RadChart1" />
        </Grid>
    </UserControl>
     
    C#
    namespace SilverlightApplication1
    {
        public partial class MainPage : UserControl
        {
            public MainPage()
            {
                InitializeComponent();
     
                List<ChartData> data = new List<ChartData>();
                data.Add(new ChartData() { YValue = 7});
                data.Add(new ChartData() { YValue = 4});
                data.Add(new ChartData() { YValue = 1});
                RadChart1.ItemsSource = data;
     
                RadChart1.DefaultView.ChartLegend.Style = this.Resources["CustomLegendStyle"] as Style;
                RadChart1.DefaultView.ChartLegendPosition = Dock.Bottom;
            }
        }
     
        public class ChartData
        {
            public double YValue
            {
                get;
                set;
            }
        }
    }

    Hope this helps.


    Kind regards,
    Freddie
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Kiran Ghanwat
    Kiran Ghanwat avatar
    38 posts
    Member since:
    Nov 2009

    Posted 01 Jul 2010 Link to this post

    Hey Freddie,

    Thanks for your reply.

    I am getting error as unknown attribute at  TargetType="telerik:ChartLegend">


    Thanks,
    Kiran Ghanwat
  4. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 02 Jul 2010 Link to this post

    Hello Kiran Ghanwat,

    Have you registered the telerik xml namespace as shown in the code we sent you in our previous reply?



    Best wishes,
    Freddie
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Donna
    Donna avatar
    1 posts
    Member since:
    Jul 2010

    Posted 04 Jul 2010 Link to this post


    Hello !
    I am also a new member. Would a newcomer be warmly welcome here? Good day you guy !



    __________________
    [url=http://moviesonlinefree.biz]Watch Predators Online Free[/url]
Back to Top