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

CartesianCustomAnnotation Content not reading any UI events

2 Answers 44 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Ravin
Top achievements
Rank 1
Ravin asked on 23 Mar 2016, 02:39 PM

Hello,

I have a custom UserControl that contains a RadExpander with some tooltips in it, and I set that control as the Content of a CartesianCustomAnnotation object which I add into my current ChartView (using the RadCartesianChart), however when I mouse over objects within the RadExpander or try to see if I can expand/collapse it, nothing happens. It is as if none of the UI events are bubbling into the Content of the CartesianCustomAnnotation.

Ex:

CartesianCustomAnnotation annotation = new CartesianCustomAnnotation() {
    HorizontalAxis = this.radCartesianChart.HorizontalAxis,
    HorizontalValue = eventDate,
    VerticalAxis = this.radCartesianChart.VerticalAxis,
    VerticalValue = annotationPosition,
    Content = annotationContent
};
chart.Annotations.Add(this.customAnnotation);

Where annotationContent is an object that holds a custom UserControl that looks like this:

<UserControl x:Class="..."
         xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
         mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400">
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <Border Grid.Column="0" BorderThickness="0,1,0,1">
            <Border.BorderBrush>
                <SolidColorBrush Color="Black" />
            </Border.BorderBrush>
            <Border.Background>
                <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
                    <GradientStopCollection>
                        <GradientStop Color="#00F1F5FB" Offset="1"/>
                        <GradientStop Color="#DAE3EC" />
                    </GradientStopCollection>
                </LinearGradientBrush>
            </Border.Background>
             
            <telerik:RadExpander x:Name="expander" IsExpanded="False" />
             
        </Border>
    </Grid>
</UserControl>

 

Thanks,
Ravin

2 Answers, 1 is accepted

Sort by
0
Accepted
Martin Ivanov
Telerik team
answered on 25 Mar 2016, 02:57 PM
Hello Ravin,

The reported behavior is caused by the fact that the default value of the IsHitTestVisible property of chart's series and annotation is False. This prevents all mouse interactions to propagate to the annotation and its children. In order to change this you can set the property to True.
CartesianCustomAnnotation annotation = new CartesianCustomAnnotation() {
    HorizontalAxis = this.radCartesianChart.HorizontalAxis,
    HorizontalValue = eventDate,
    VerticalAxis = this.radCartesianChart.VerticalAxis,
    VerticalValue = annotationPosition,
    Content = annotationContent,
    IsHitTestVisible = true,
};

Regards,
Martin
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Ravin
Top achievements
Rank 1
answered on 25 Mar 2016, 04:39 PM

Thanks Martin, that solved the issue I was having!

I also marked your post as the answer. Thanks for the quick response!

Tags
ChartView
Asked by
Ravin
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Ravin
Top achievements
Rank 1
Share this question
or