TrackerBall vertical Line not working with template override

2 posts, 0 answers
  1. Avneesh
    Avneesh avatar
    13 posts
    Member since:
    Jul 2013

    Posted 17 Oct 2013 Link to this post

    I wanted to add a title to the Cartesian Chart and used the default template to add a textblock as below :

     <Style x:Key="RadCartesianChartStyle" TargetType="{x:Type controls:ExtendedRadCartesianChart}">
                               <Setter Property="MinWidth" Value="100"/>
                               <Setter Property="MinHeight" Value="100"/>
                               <Setter Property="Background" Value="Transparent"/>
                               <Setter Property="HorizontalContentAlignment" Value="Center"/>
                               <Setter Property="VerticalContentAlignment" Value="Center"/>                                
                               <Setter Property="Template">
                               <ControlTemplate TargetType="{x:Type controls:ExtendedRadCartesianChart}">
                               <Border x:Name="layoutRoot" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
                                                <StackPanel Orientation="Vertical">
                                                  <TextBlock Text="This is a test Title" HorizontalAlignment="Center"></TextBlock>
                                 <ContentPresenter x:Name="emptyContent" ContentTemplate="{TemplateBinding EmptyContentTemplate}" Content="{TemplateBinding EmptyContent}" 
                                                                    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                 <Canvas x:Name="adornerContainer" Background="Transparent" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                                 <Canvas x:Name="labelContainer" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                                 <Canvas x:Name="renderSurface" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                                 <Border x:Name="plotAreaDecoration" Style="{TemplateBinding PlotAreaStyle}"/>
                               <Setter Property="TrackBallLineStyle">
                               <Style TargetType="{x:Type Polyline}">
                               <Setter Property="Stroke" Value="#FF828282"/>
                               <Setter Property="StrokeThickness" Value="2"/>
                               <Setter Property="DragZoomBorderStyle">
                               <Style TargetType="{x:Type Border}">
                               <Setter Property="BorderBrush" Value="#FF828282"/>
                               <Setter Property="BorderThickness" Value="1"/>
                               <Setter Property="Background" Value="#40FFFFFF"/>

    Now when I move the mouse over the chart, the vertical tracker line doesn't appear until I move the mouse over the series line and then the trackerball information appears fine. What property do I need to set  to allow the trackerball vertical line to appear as it appears before overriding with this control template?
  2. Tina Stancheva
    Tina Stancheva avatar
    3299 posts

    Posted 22 Oct 2013 Link to this post

    Hello Avneesh,

    The Trackball behavior doesn't work as you've wrapped the template elements of the RadCartasianChart in a StackPanel. However the StackPanel measures its children with infinity which sends incorrect information to the trackball elements and they cannot be properly displayed.

    This is why you can either modify your template to follow the approach Evgenia suggested in this thread or simply create a TextBlock in your view and display it on top of the RadCartasianChart. This would eliminate the need of editing the default ControlTemplate of the component.

    Tina Stancheva
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top