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

TrackerBall vertical Line not working with template override

1 Answer 37 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Avneesh
Top achievements
Rank 1
Avneesh asked on 17 Oct 2013, 10:07 AM
Hi,
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">
                           <Setter.Value>
                           <ControlTemplate TargetType="{x:Type controls:ExtendedRadCartesianChart}">
                           <Border x:Name="layoutRoot" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
                           <Grid>
                                            <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}" 
                                              IsHitTestVisible="False" 
                                              Visibility="Collapsed" 
                                              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}"/>
                             </Canvas>
                             </Canvas>
                             </Canvas>
                                           </StackPanel>
                           </Grid>
                           </Border>
                           </ControlTemplate>
                           </Setter.Value>
                           </Setter>
                           <Setter Property="TrackBallLineStyle">
                           <Setter.Value>
                           <Style TargetType="{x:Type Polyline}">
                           <Setter Property="Stroke" Value="#FF828282"/>
                           <Setter Property="StrokeThickness" Value="2"/>
                           </Style>
                           </Setter.Value>
                           </Setter>
                           <Setter Property="DragZoomBorderStyle">
                           <Setter.Value>
                           <Style TargetType="{x:Type Border}">
                           <Setter Property="BorderBrush" Value="#FF828282"/>
                           <Setter Property="BorderThickness" Value="1"/>
                           <Setter Property="Background" Value="#40FFFFFF"/>
                           </Style>
                           </Setter.Value>
                           </Setter>
                  </Style>

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?

1 Answer, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 22 Oct 2013, 10:09 AM
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.

Regards,
Tina Stancheva
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
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 >>
Tags
ChartView
Asked by
Avneesh
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Share this question
or