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

TrackBallInfoStyle button click

1 Answer 152 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 23 Apr 2014, 03:11 AM
I want to add a button into the trackball information that is displayed.  I can add a button and it displays but the MouseLeftButtonUp never fires.  Also, in the code behind I cannot access "btnDD" in the example below.  

            <telerik:RadCartesianChart.Behaviors>
                <telerik:ChartTrackBallBehavior ShowTrackInfo="True"
ShowIntersectionPoints="True"
TrackInfoUpdated="ChartTrackBallBehavior_TrackInfoUpdated"/>
            </telerik:RadCartesianChart.Behaviors>


            <telerik:RadCartesianChart.TrackBallInfoStyle>
                <Style TargetType="telerik:TrackBallInfoControl">
                    <Setter Property="HeaderTemplate">
                        <Setter.Value>
                            <DataTemplate>
                                <StackPanel>
                                <TextBlock Text="{Binding}" 
  FontSize="14"
  Foreground="Blue"/>
                                <Button x:Name="btnDD" MouseLeftButtonUp="btnDD_MouseLeftButtonUp">View Files</Button>
                                </StackPanel>
                            </DataTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </telerik:RadCartesianChart.TrackBallInfoStyle>

1 Answer, 1 is accepted

Sort by
0
Petar Marchev
Telerik team
answered on 23 Apr 2014, 08:11 AM
Hello Kevin,

You cannot access the btnDD because it is defined in a DataTemplate and the framework does not allow you to access this element because you might use the template in many places and you will have many btnDD buttons.

By default the track ball info control has its IsHitTestVisible property set to false. This is to prevent the track ball from hiding when the mouse is over it. If the hit test property is set to true, the track info control will swallow the mouse events and this will trigger the mouse leave event of the plot area, which in turn will hide the track ball, so you will not be able to click the button.

Perhaps you can remove the track ball behavior and use annotations instead. Check out our track-ball-like-annotations sdk example. You may want to use the sdk browser for easier browsing. The example demonstrates how you can use annotations to mimic a track-ball-like feature. You can then update this example and place a button which you can click. I hope this helps.

Regards,
Petar Marchev
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
ChartView
Asked by
Kevin
Top achievements
Rank 1
Answers by
Petar Marchev
Telerik team
Share this question
or