CartesianCustomAnnotation Content not reading any UI events

3 posts, 1 answers
  1. Ravin
    Ravin avatar
    16 posts
    Member since:
    Jun 2012

    Posted 23 Mar Link to this post

    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. Answer
    Martin
    Admin
    Martin avatar
    1099 posts

    Posted 25 Mar Link to this post

    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.
  3. DevCraft banner
  4. Ravin
    Ravin avatar
    16 posts
    Member since:
    Jun 2012

    Posted 25 Mar Link to this post

    Thanks Martin, that solved the issue I was having!

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

Back to Top